|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.jgamegrid.Actor ch.aplu.jgamegrid.GGButtonBase ch.aplu.jgamegrid.GGCheckButton
public class GGCheckButton
Class that implements a check button actor with standard behavior. Events are generated when the button changes its state due to a mouse click from checked to unchecked or vise versa. In order to align several check buttons, the actor's image is centered in the middle of the check box and extends the same size to the left and right determined by the text length. The left part is always transparent. The default hot spot area is the square that surrounds the cross. Use Actor.setLocationOffset() to fine tune the button location.
Field Summary |
---|
Fields inherited from class ch.aplu.jgamegrid.Actor |
---|
gameGrid, nbCycles |
Constructor Summary | |
---|---|
GGCheckButton(java.lang.String text)
Creates a unchecked check button with the given text annotation, black text and white background colors. |
|
GGCheckButton(java.lang.String text,
boolean isChecked)
Creates a check button with the given text annotation, black text and and white background colors. |
|
GGCheckButton(java.lang.String text,
java.awt.Color textColor,
java.awt.Color bkColor)
Creates a unchecked check button with the given text annotation and given text and background colors. |
|
GGCheckButton(java.lang.String text,
java.awt.Color textColor,
java.awt.Color bkColor,
boolean isChecked)
Creates a check button with the given text annotation and given text and background colors. |
Method Summary | |
---|---|
void |
addCheckButtonListener(GGCheckButtonListener listener)
Registers a GGCheckButtonListener to get notifications when the button is manipulated. |
boolean |
isChecked()
Returns the current state of the button. |
void |
reset()
Overrides the actor's reset() called when the button is added to the game grid. |
void |
setChecked(boolean b)
Sets the button in the checked/unchecked state. |
Methods inherited from class ch.aplu.jgamegrid.GGButtonBase |
---|
isEnabled, setEnabled, setHotspotArea, setRefreshEnabled |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GGCheckButton(java.lang.String text)
text
- the text annotationpublic GGCheckButton(java.lang.String text, boolean isChecked)
text
- the text annotationisChecked
- if true, the check box is initially checkedpublic GGCheckButton(java.lang.String text, java.awt.Color textColor, java.awt.Color bkColor)
text
- the text annotationtextColor
- the color of the annotation textbkColor
- the background colorpublic GGCheckButton(java.lang.String text, java.awt.Color textColor, java.awt.Color bkColor, boolean isChecked)
text
- the text annotationtextColor
- the color of the annotation textbkColor
- the background colorisChecked
- if true, the check box is initially checkedMethod Detail |
---|
public void reset()
reset
in class Actor
public boolean isChecked()
public void setChecked(boolean b)
b
- if true, the button is checked; otherwise it is uncheckedpublic void addCheckButtonListener(GGCheckButtonListener listener)
listener
- the GGCheckButtonListener to register
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |