public class GGTextField
extends java.lang.Object
Constructor and Description |
---|
GGTextField(GameGrid gg,
Location location,
boolean enableRefresh)
Creates a GGTextField with standard attributes and no text.
|
GGTextField(GameGrid gg,
java.lang.String text,
Location location,
boolean enableRefresh)
Creates a GGTextField instance with standard attributes.
|
Modifier and Type | Method and Description |
---|---|
TextActor |
getTextActor()
Returns the current TextActor used for this text field.
|
int |
getTextHeight()
Returns the height of the text.
|
int |
getTextWidth()
Returns the total width of the text.
|
void |
hide()
Hides the text.
|
boolean |
isVisible()
Returns the visibility of the text.
|
void |
setBgColor(java.awt.Color bgColor)
Sets the background color attribute.
|
void |
setFont(java.awt.Font font)
Sets the font attribute.
|
void |
setLocation(Location location)
Sets the location attribute.
|
void |
setLocationOffset(java.awt.Point locationOffset)
Sets a pixel offset in x- any y-direction relative to the current
location.
|
void |
setText(java.lang.String text)
Sets the text attribute.
|
void |
setTextColor(java.awt.Color textColor)
Sets the text color attribute.
|
void |
show()
Displays the text.
|
public GGTextField(GameGrid gg, java.lang.String text, Location location, boolean enableRefresh)
gg
- the GameGrid where to add the text actorlocation
- the location where the the text will be placed
(horizontally left aligned, vertically center aligned)text
- the text string to showenableRefresh
- if true, the automatic refresh of the game grid is turned on;
otherwise refresh must be called by user code or performed by the simulation threadpublic GGTextField(GameGrid gg, Location location, boolean enableRefresh)
gg
- the GameGrid where to add the text actorlocation
- the location where the the text will be placed
(horizontally left aligned, vertically center aligned)enableRefresh
- if true, the automatic refresh of the game grid is turned on;
otherwise refresh must be called by user code or performed by the simulation threadpublic void show()
public void hide()
public boolean isVisible()
public void setLocation(Location location)
location
- the location where the the text will be placed
(horizontally left aligned, vertically center aligned)public void setText(java.lang.String text)
text
- the text string to showpublic void setTextColor(java.awt.Color textColor)
textColor
- the color of the textpublic void setBgColor(java.awt.Color bgColor)
bgColor
- the color of the text backgroundpublic void setFont(java.awt.Font font)
font
- the text fontpublic void setLocationOffset(java.awt.Point locationOffset)
locationOffset
- x,y displacement (x to the left, y downwards)public TextActor getTextActor()
public int getTextWidth()
public int getTextHeight()