org.deken.game.component
Class GToggleButton

java.lang.Object
  extended by org.deken.game.sprites.Sprite
      extended by org.deken.game.component.GComponent
          extended by org.deken.game.component.GTextContainer
              extended by org.deken.game.component.GButton
                  extended by org.deken.game.component.GToggleButton
All Implemented Interfaces:
InputListener, InputMouseListener, Updateable

public class GToggleButton
extends GButton

Title: GToggleButton

Description: A simple Game Button the can be toggled on and off. It internally keeps track if its toggled state. This inherits all the features of the GButton.

Copyright: Copyright (c) Nov 10, 2013

Version:
1.0
Author:
Gary Deken

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deken.game.component.GComponent
GComponent.Alignment, GComponent.MouseActions
 
Field Summary
 
Fields inherited from class org.deken.game.component.GButton
ANIMATION_DEFAULT, ANIMATION_DIABLED, ANIMATION_PRESSED, ANIMATION_ROLLOVER, animationIndex, buttonListeners, buttonNotify
 
Fields inherited from class org.deken.game.component.GTextContainer
baseAnimation, gText
 
Fields inherited from class org.deken.game.component.GComponent
horizontalAlignment, id, invalid, keyPolling, mouseActions, parent, requestKeyPolling, screenHeight, screenWidth, verticalAlignment, xOffSet, yOffSet
 
Fields inherited from class org.deken.game.sprites.Sprite
boundingBox, collisionMap, location, size
 
Constructor Summary
GToggleButton()
          GButton is created with the Mouse action of button 1 pressed.
GToggleButton(Animation animation)
          GToggleButton is created with the Mouse action of button 1 pressed.
GToggleButton(GText gText)
          GToggleButton is created with the Mouse action of button 1 pressed.
GToggleButton(GText gText, java.awt.Color fontHighlightColor)
          GToggleButton is created with the Mouse action of button 1 pressed.
GToggleButton(java.lang.String text)
          GToggleButton is created with the Mouse action of button 1 pressed.
GToggleButton(java.lang.String text, java.awt.Font font, java.awt.Color fontColor, java.awt.Color fontHighlightColor)
          GToggleButton is created with the Mouse action of button 1 pressed.
 
Method Summary
 void addLinkToggleButton(GToggleButton button)
           
 GToggleButton copy()
           
 boolean isToggled()
           
 void notifyListener(InputMouseAction inputMouseAction)
          Receive Mouse actions.
 void setClickUnToggles(boolean clickUnToggles)
           
 void setEnabled(boolean b)
          setEnabled
 void setToggled(boolean newToggled)
          Makes this button selected or unSelected.
 
Methods inherited from class org.deken.game.component.GButton
addAnimation, addFontColor, addGText, addInputAction, addKeyAction, addListener, copyGButtonBase, draw, getAlignment, getAnimation, getAnimation, getFontHighlightColor, getImage, getInputActionIds, getKeyAssociated, hasListeners, notifyListener, setAlignment, setAnimation, setFontHighlightColor, setGText, setKeyAssociated, setMonitored, spriteCollison, update, validate
 
Methods inherited from class org.deken.game.component.GTextContainer
getBaseAnimation, getGText, setInvalid
 
Methods inherited from class org.deken.game.component.GComponent
addMouseAction, copyBase, getHorizontalAlignment, getMouseActions, getParent, getVerticalAlignment, getXLocation, getYLocation, isEnabled, positionHorizontalAlignment, positionVerticalAlignment, requestKeyPolling, setHorizontalAlignment, setKeyPolling, setParent, setVerticalAlignment
 
Methods inherited from class org.deken.game.sprites.Sprite
getBounds, getDepth, getHeight, getLocation, getName, getSize, getWidth, removeFromMap, setBoundingBox, setBoundingBox, setCollisionMap, setLocation, setName, setSize, toString, updateLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GToggleButton

public GToggleButton()
GButton is created with the Mouse action of button 1 pressed.


GToggleButton

public GToggleButton(java.lang.String text)
GToggleButton is created with the Mouse action of button 1 pressed.

Parameters:
text - String

GToggleButton

public GToggleButton(Animation animation)
GToggleButton is created with the Mouse action of button 1 pressed.

Parameters:
animation - Animation

GToggleButton

public GToggleButton(java.lang.String text,
                     java.awt.Font font,
                     java.awt.Color fontColor,
                     java.awt.Color fontHighlightColor)
GToggleButton is created with the Mouse action of button 1 pressed.

Parameters:
text -
font -
fontColor -
fontHighlightColor -

GToggleButton

public GToggleButton(GText gText)
GToggleButton is created with the Mouse action of button 1 pressed.

Parameters:
gText -

GToggleButton

public GToggleButton(GText gText,
                     java.awt.Color fontHighlightColor)
GToggleButton is created with the Mouse action of button 1 pressed.

Parameters:
gText -
fontHighlightColor -
Method Detail

addLinkToggleButton

public void addLinkToggleButton(GToggleButton button)

copy

public GToggleButton copy()
Overrides:
copy in class GButton
Returns:
GameButton

isToggled

public boolean isToggled()

notifyListener

public void notifyListener(InputMouseAction inputMouseAction)
Receive Mouse actions. The mouse hover action does not set the selected boolean. The selected boolean is when this button is selected by another means.

Specified by:
notifyListener in interface InputMouseListener
Overrides:
notifyListener in class GButton
Parameters:
inputMouseAction -

setClickUnToggles

public void setClickUnToggles(boolean clickUnToggles)

setEnabled

public void setEnabled(boolean b)
Description copied from class: GButton
setEnabled

Calls the super method, and set the current animation to the enabled or disabled.

Overrides:
setEnabled in class GButton
Parameters:
b - boolean

setToggled

public void setToggled(boolean newToggled)
Makes this button selected or unSelected.

Parameters:
newToggled -