|
|||||||||
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.GGToggleButton
public class GGToggleButton
Class that implements a toggle button (2-state button) actor with standard behavior. Events are generated when the button changes its state due to a mouse click. The button is centered in the middle of a cell. Use Actor.setLocationOffset() to fine tune the button location.
Field Summary |
---|
Fields inherited from class ch.aplu.jgamegrid.Actor |
---|
gameGrid, nbCycles |
Constructor Summary | |
---|---|
GGToggleButton(java.lang.String buttonImage)
Same as GGToggleButton(String buttonImage, false, false) (no rollover, untoggled). |
|
GGToggleButton(java.lang.String buttonImage,
boolean isRollover)
Same as GGToggleButton(String buttonImage, boolean isRollover, false) (untoggled). |
|
GGToggleButton(java.lang.String buttonImage,
boolean isRollover,
boolean isToggled)
Creates a button from the given sprite images. |
Method Summary | |
---|---|
void |
addButtonOverListener(GGButtonOverListener listener)
Registers a GGOverButtonListener to get notifications when the mouse cursor enters the active mouse area. |
void |
addToggleButtonListener(GGToggleButtonListener listener)
Registers a GGToggleButtonListener to get notifications when the button is manipulated. |
boolean |
isToggled()
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 |
setToggled(boolean b)
Sets the button in the toggled/untoggled 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 GGToggleButton(java.lang.String buttonImage, boolean isRollover, boolean isToggled)
buttonImage
- the filename or URL of the 2 or 4 button spritesisRollover
- if true, rollover imaged are usedisToggled
- if true, the button is initially toggled; otherwise it is untoggledpublic GGToggleButton(java.lang.String buttonImage, boolean isRollover)
buttonImage
- the filename or URL of the 2 or 4 button spritespublic GGToggleButton(java.lang.String buttonImage)
buttonImage
- the filename or URL of the 2 button spritesMethod Detail |
---|
public void reset()
reset
in class Actor
public boolean isToggled()
public void setToggled(boolean b)
b
- if true, the button is toggled; otherwise it is untoggledpublic void addToggleButtonListener(GGToggleButtonListener listener)
listener
- the GGToggleButtonListener to registerpublic void addButtonOverListener(GGButtonOverListener listener)
listener
- the GGButtonOverListener to register
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |