Package wprover
Class CText
- java.lang.Object
-
- wprover.CClass
-
- wprover.CText
-
public class CText extends CClass
CText is a class that represents a text object in a graphical application. It extends the CClass class and provides methods to manipulate and display text.
-
-
Field Summary
Fields Modifier and Type Field Description static intCNAME_TEXTstatic intNAME_TEXTbooleannameTextShownstatic intNORMAL_TEXTCTextValuetvaluestatic intVALUE_TEXT
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrag(double dx, double dy)Drags the text object by the given offsets (dx, dy).voiddrag(double x0, double y0, double dx, double dy)Drags the text object from the given starting point (x0, y0) by the given offsets (dx, dy).voiddraw(java.awt.Graphics2D g2)Draws the text object using the provided Graphics2D context.voiddraw(java.awt.Graphics2D g2, boolean select)Draws the text object with a selection highlight using the provided Graphics2D context.booleanequals(java.lang.Object obj)Checks if this CText object is equal to another object.java.lang.StringgetDescription()Retrieves a description of this text object.java.awt.FontgetFont()Retrieves the font of this CText object.intgetFontSize()Retrieves the font size of this CText object.java.awt.PointgetLocation()Retrieves the location of the text as a Point object.java.lang.StringgetString()Retrieves the string content of this CText object.intgetSX()Retrieves the x-coordinate for drawing the text.intgetSY()Retrieves the y-coordinate for drawing the text.java.lang.StringgetText()Retrieves the text content of this CText object.java.awt.DimensiongetTextDimension()Retrieves the dimensions of the text as a Dimension object.intgetType()Retrieves the type of this CText object.java.lang.StringgetValueText()Retrieves the value text of this CText object.intgetX()Retrieves the x-coordinate of the text.intgetY()Retrieves the y-coordinate of the text.booleaninRect(double x0, double y0, double x1, double y1)Checks if the given rectangle defined by (x0, y0) and (x1, y1) intersects with this text object.booleanisdraw()Checks if the text should be drawn based on its visibility and the visibility of its parent.voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads the text object from the specified data input stream.voidmove(double dx, double dy)Moves the text object by the specified offsets.voidSave(java.io.DataOutputStream out)Saves the text object to the specified data output stream.voidSavePS(java.io.FileOutputStream fp, int stype)Saves the text object as a PostScript file.booleanselect(double x1, double y1)Checks if the given point (x1, y1) is within the bounds of this text object.voidsetBold()Sets the font to bold.voidsetFont(java.awt.Font f)Sets the font of this CText object.voidsetFontSize(int n)Sets the font size of this CText object.voidsetPlain()Sets the font to plain.voidsetText(java.lang.String s)Sets the text content of this CText object based on its type.voidsetText1(java.lang.String s)Sets the text content of this CText object.voidsetTextType(int t)Sets the text type and parses the text value.voidsetXY(int x, int y)Sets the x and y coordinates of this CText object.java.lang.StringTypeString()Retrieves a string representation of the type of this text object.-
Methods inherited from class wprover.CClass
copy, get_type, getColor, getColorIndex, getname, getPSLineString, hasNameSet, saveSuper, saveSuperColor, setAttr, setAttrAux, setColor, setDash, setInFlashing, setWidth, stopFlash, toString, visible
-
-
-
-
Field Detail
-
NORMAL_TEXT
public static final int NORMAL_TEXT
- See Also:
- Constant Field Values
-
NAME_TEXT
public static final int NAME_TEXT
- See Also:
- Constant Field Values
-
CNAME_TEXT
public static final int CNAME_TEXT
- See Also:
- Constant Field Values
-
VALUE_TEXT
public static final int VALUE_TEXT
- See Also:
- Constant Field Values
-
tvalue
public CTextValue tvalue
-
nameTextShown
public boolean nameTextShown
-
-
Constructor Detail
-
CText
public CText()
Default constructor for the CText class. Initializes the text object with default values.
-
CText
public CText(CClass f, double dx, double dy, int type)
Constructor for the CText class. Initializes the text object with the specified parent, coordinates, and type.- Parameters:
f- the parent CClass objectdx- the x-coordinate offsetdy- the y-coordinate offsettype- the type of the text
-
CText
public CText(int x, int y, java.lang.String s)Constructor for the CText class. Initializes the text object with the specified coordinates and string.- Parameters:
x- the x-coordinate of the texty- the y-coordinate of the texts- the string content of the text
-
-
Method Detail
-
getFont
public java.awt.Font getFont()
Retrieves the font of this CText object.- Returns:
- the font
-
setTextType
public void setTextType(int t)
Sets the text type and parses the text value.- Parameters:
t- the text type to set
-
getFontSize
public int getFontSize()
Retrieves the font size of this CText object.- Returns:
- the font size
-
setBold
public void setBold()
Sets the font to bold.
-
setPlain
public void setPlain()
Sets the font to plain.
-
setFont
public void setFont(java.awt.Font f)
Sets the font of this CText object.- Parameters:
f- the font to set
-
setFontSize
public void setFontSize(int n)
Sets the font size of this CText object.- Parameters:
n- the font size to set
-
setXY
public void setXY(int x, int y)Sets the x and y coordinates of this CText object.- Parameters:
x- the x-coordinate to sety- the y-coordinate to set
-
move
public void move(double dx, double dy)Moves the text object by the specified offsets.- Parameters:
dx- the x-offset to move bydy- the y-offset to move by
-
equals
public boolean equals(java.lang.Object obj)
Checks if this CText object is equal to another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare with- Returns:
- true if the objects are equal, false otherwise
-
getText
public java.lang.String getText()
Retrieves the text content of this CText object.- Returns:
- the text content
-
setText1
public void setText1(java.lang.String s)
Sets the text content of this CText object.- Parameters:
s- the text content to set
-
setText
public void setText(java.lang.String s)
Sets the text content of this CText object based on its type.- Parameters:
s- the text content to set
-
getString
public java.lang.String getString()
Retrieves the string content of this CText object.- Returns:
- the string content
-
getTextDimension
public java.awt.Dimension getTextDimension()
Retrieves the dimensions of the text as a Dimension object.- Returns:
- the dimensions of the text
-
getX
public int getX()
Retrieves the x-coordinate of the text.- Returns:
- the x-coordinate
-
getY
public int getY()
Retrieves the y-coordinate of the text.- Returns:
- the y-coordinate
-
getLocation
public java.awt.Point getLocation()
Retrieves the location of the text as a Point object.- Returns:
- the location of the text
-
getType
public int getType()
Retrieves the type of this CText object.- Returns:
- the type of the text
-
isdraw
public boolean isdraw()
Checks if the text should be drawn based on its visibility and the visibility of its parent.
-
getSX
public int getSX()
Retrieves the x-coordinate for drawing the text.- Returns:
- the x-coordinate for drawing
-
getSY
public int getSY()
Retrieves the y-coordinate for drawing the text.- Returns:
- the y-coordinate for drawing
-
getValueText
public java.lang.String getValueText()
Retrieves the value text of this CText object.- Returns:
- the value text
-
draw
public void draw(java.awt.Graphics2D g2)
Draws the text object using the provided Graphics2D context.
-
draw
public void draw(java.awt.Graphics2D g2, boolean select)Draws the text object with a selection highlight using the provided Graphics2D context.- Parameters:
g2- the Graphics2D contextselect- true if the text object is selected, false otherwise
-
TypeString
public java.lang.String TypeString()
Retrieves a string representation of the type of this text object.- Specified by:
TypeStringin classCClass- Returns:
- the type string
-
getDescription
public java.lang.String getDescription()
Retrieves a description of this text object.- Specified by:
getDescriptionin classCClass- Returns:
- the description
-
inRect
public boolean inRect(double x0, double y0, double x1, double y1)Checks if the given rectangle defined by (x0, y0) and (x1, y1) intersects with this text object.- Parameters:
x0- the x-coordinate of the first corner of the rectangley0- the y-coordinate of the first corner of the rectanglex1- the x-coordinate of the opposite corner of the rectangley1- the y-coordinate of the opposite corner of the rectangle- Returns:
- true if the rectangle intersects with this text object, false otherwise
-
select
public boolean select(double x1, double y1)Checks if the given point (x1, y1) is within the bounds of this text object.- Parameters:
x1- the x-coordinate of the pointy1- the y-coordinate of the point- Returns:
- true if the point is within the bounds, false otherwise
-
drag
public void drag(double dx, double dy)Drags the text object by the given offsets (dx, dy).- Parameters:
dx- the x-offset to drag bydy- the y-offset to drag by
-
drag
public void drag(double x0, double y0, double dx, double dy)Drags the text object from the given starting point (x0, y0) by the given offsets (dx, dy).- Parameters:
x0- the starting x-coordinatey0- the starting y-coordinatedx- the x-offset to drag bydy- the y-offset to drag by
-
SavePS
public void SavePS(java.io.FileOutputStream fp, int stype) throws java.io.IOExceptionSaves the text object as a PostScript file.
-
Save
public void Save(java.io.DataOutputStream out) throws java.io.IOExceptionSaves the text object to the specified data output stream.
-
Load
public void Load(java.io.DataInputStream in, DrawProcess dp) throws java.io.IOExceptionLoads the text object from the specified data input stream.
-
-