|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectexe.GAIGStext
public class GAIGStext
This is the new GAIGS support class for drawing text to the visualization
pane. Unlike GAIGSlabel, which previously provided support for
drawing text to the screen, a GAIGStext object can be used to
precisely position the text that is to be drawn. The appearance of this text
is controlled by the following fields:
x - The x-coordinate (usually within the bounds [0,1]) at which the
text is to be drawn. How the text is displayed relative to this
x-coordinate is controlled by the halign field.
y - The y-coordinate (usually within the bounds [0,1]) at which the
text is to be drawn. How the text is displayed relative to this
y-coordinate is controlled by the valign field.
halign - Controls how the text is drawn relative to the x-coordinate
stored in x. This field can have one of three possible values:
HCENTER - Centers the text horizontally about x.
HLEFT - Left-justifies the text with x as the left margin.
HRIGHT - Right-justifies the text with x as the right margin.
valign - Controls how the text is drawn relative to the y-coordinate
stored in y. This field can have one of three possible values:
VCENTER - Centers the text vertically about y.
VBOTTOM - Draws the lowest line of text at y.
VTOP - Draws the highest line of text at y.
fontsize - The size of the text that is to be drawn. This corresponds to
the fontsize field used in the other GAIGS structures.
color - The default color of the text that is to be drawn. This is
similar to the coloring used in other GAIGS structures; the
value is a hexadecimal RGB string of the form #000000. Note that
color escapes (e.g., \#000000) can be used to change the color
of text within a line. However, each new line in the text String
will revert back to the default color stored in color so a color
escape is required to begin a line in a different color than the
color stored in the color field.
text - The actual text String that is to be drawn to the screen. This
String can have multiple lines, and the newlines will be
preserved when it is displayed. Note that the vertical
positioning set using valign uses all the lines of text to
compute where the text is displayed. For example, a five-line
String that has been vertically centered will appear with its
third line positioned vertically on y.
| Field Summary | |
|---|---|
static int |
HCENTER
Value that can be assigned to halign to center the text
horizontally about the x-coordinate in x. |
static int |
HLEFT
Value that can be assigned to halign to left-justify the
text horizontally at the x-coordinate in x. |
static int |
HRIGHT
Value that can be assigned to halign to right-justify the
text horizontally at the x-coordinate in x. |
static int |
VBOTTOM
Value that can be assigned to valign to position the lowest
line of text at the y-coordinate in y. |
static int |
VCENTER
Value that can be assigned to valign to center the text
vertically about the y-coordinate in y. |
static int |
VTOP
Value that can be assigned to valign to position the
highest line of text at the y-coordinate in y. |
| Fields inherited from interface exe.GAIGSdatastr |
|---|
DEFAULT_COLOR, DEFAULT_FONT_SIZE, DEFAULT_NAME, DEFAULT_X1, DEFAULT_X2, DEFAULT_Y1, DEFAULT_Y2 |
| Constructor Summary | |
|---|---|
GAIGStext()
Default constructor that assigns default values to all fields. |
|
GAIGStext(double x,
double y)
Constuctor that only sets the location of the text. |
|
GAIGStext(double x,
double y,
int halign,
int valign,
double fontsize,
java.lang.String color,
java.lang.String text)
Constructor that sets all fields for this GAIGStext object. |
|
GAIGStext(double x,
double y,
java.lang.String text)
Constructor that sets the text and its location. |
|
| Method Summary | |
|---|---|
java.lang.String |
getColor()
Gives the value stored to color. |
double |
getFontsize()
Gives the value stored to fontsize. |
int |
getHalign()
Gives the value stored to halign. |
java.lang.String |
getName()
Method required to implement the GAIGSdatastr interface. |
java.lang.String |
getText()
Gives the value stored to text. |
int |
getValign()
Gives the value stored to valign. |
double |
getX()
Gives the value stored to x. |
double |
getY()
Gives the value stored to y. |
void |
setColor(java.lang.String color)
Sets the value of color. |
void |
setFontsize(double fontsize)
Sets the value of fontsize. |
boolean |
setHalign(int halign)
Sets the value of halign. |
void |
setName(java.lang.String text)
Method required to implement the GAIGSdatastr interface. |
void |
setText(java.lang.String text)
Sets the value of text. |
boolean |
setValign(int valign)
Sets the value of valign. |
void |
setX(double x)
Sets the value of x. |
void |
setY(double y)
Sets the value of y. |
java.lang.String |
toXML()
Returns the GAIGS XML representation of this GAIGStext
object as a String. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int HCENTER
halign to center the text
horizontally about the x-coordinate in x.
public static final int HLEFT
halign to left-justify the
text horizontally at the x-coordinate in x.
public static final int HRIGHT
halign to right-justify the
text horizontally at the x-coordinate in x.
public static final int VCENTER
valign to center the text
vertically about the y-coordinate in y.
public static final int VBOTTOM
valign to position the lowest
line of text at the y-coordinate in y.
public static final int VTOP
valign to position the
highest line of text at the y-coordinate in y.
| Constructor Detail |
|---|
public GAIGStext()
x = 0.5 y = 0.5 halign = HCENTER valign = VCENTER fontsize = 0.04 color = "#000000" text = ""
public GAIGStext(double x,
double y)
halign = HCENTER valign = VCENTER fontsize = 0.04 color = "#000000" text = ""
x - The x-coordinate for the text (usually within [0,1]).y - The y-coordinate for the text (usually within [0,1]).
public GAIGStext(double x,
double y,
java.lang.String text)
halign = HCENTER valign = VCENTER fontsize = 0.04 color = "#000000"
x - The x-coordinate for the text (usually within [0,1]).y - The y-coordinate for the text (usually within [0,1]).text - The text that is to be displayed on the screen.
public GAIGStext(double x,
double y,
int halign,
int valign,
double fontsize,
java.lang.String color,
java.lang.String text)
GAIGStext object.
x - The x-coordinate for the text (usually within [0,1]).y - The y-coordinate for the text (usually within [0,1]).halign - One of the three possible constant values used to define
the horizontal alignment of the text relative to
x. An invalid input defaults to
HCENTER.valign - One of the three possible constant values used to define
the vertical alignment of the text relative to
y. An invalid input defaults to
VCENTER.fontsize - The size of the text that is to be displayed. Functions
similarly to other GAIGS structures.color - The default color in which the text is to be drawn.text - The text that is to be displayed on the screen.| Method Detail |
|---|
public double getX()
x.
GAIGStext object.public double getY()
y.
GAIGStext object.public int getHalign()
halign.
GAIGStext object.public int getValign()
valign.
GAIGStext object.public double getFontsize()
fontsize.
fontsize for this GAIGStext
object.public java.lang.String getColor()
color.
String for this GAIGStext
object.public java.lang.String getText()
text.
String for this GAIGStext
object.public java.lang.String getName()
GAIGSdatastr interface.
Returns the value stored in text. This method is identical
to getText.
getName in interface GAIGSdatastrString for this GAIGStext
object.public void setX(double x)
x. This should usually be in the range
[0,1].
x - The new x-coordinate for this GAIGStext object.public void setY(double y)
y. This should usually be in the range
[0,1].
y - The new y-coordinate for this GAIGStext object.public boolean setHalign(int halign)
halign. The value of halign
remains unchanged if an invalid input is given.
halign - The new horizontal alignment for this
GAIGStext object.
True if halign was successfully
changed; false otherwise.public boolean setValign(int valign)
valign. The value of valign
remains unchanged if an invalid input is given.
valign - The new vertical alignment for this GAIGStext
object.
True if valign was successfully
changed; false otherwise.public void setFontsize(double fontsize)
fontsize.
fontsize - The new fontsize for this
GAIGStext object.public void setColor(java.lang.String color)
color.
color - The new default color for this GAIGStext
object.public void setText(java.lang.String text)
text.
text - The new text String for this
GAIGStext object.public void setName(java.lang.String text)
GAIGSdatastr interface.
Sets the value of text. This method is identical to
setText.
setName in interface GAIGSdatastrtext - The new text String for this
GAIGStext object.public java.lang.String toXML()
GAIGStext
object as a String.
toXML in interface GAIGSdatastrString containing the GAIGS XML representation of
this GAIGStext object.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||