|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.jgamegrid.GGTextField
public class GGTextField
Class to provide a dynamically created line of text shown in a game grid window. Gets its functionality from a TextActor instance (no subclassing of TextActor in order to shield the user from the many Actor class methods.) Whenever the text, fontSize, textColor, bgColor or typeface attribute is altered, the old text actor is removed from the game grid and a new actor is created and added to the game grid on the next show() invocation.
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 threadMethod Detail |
---|
public void show()
GameGrid.setPaintOrder(Class... classes)
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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |