com.jme.ui
Class UIButton

java.lang.Object
  extended bycom.jme.scene.Spatial
      extended bycom.jme.scene.Node
          extended bycom.jme.ui.UIObject
              extended bycom.jme.ui.UIActiveObject
                  extended bycom.jme.ui.UIButton
All Implemented Interfaces:
java.io.Serializable

public class UIButton
extends UIActiveObject

UIButton is a UIObject derived class that uses mouse input to change out the texture that is shown on the button

Author:
schustej
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jme.ui.UIActiveObject
_actions, _hitArea, _inputHandler, _state, DOWN, DRAW_DOWN, DRAW_OVER, OVER, SELECTED, UP
 
Fields inherited from class com.jme.ui.UIObject
_bottomborder, _height, _leftborder, _quad, _rightborder, _textureStates, _topborder, _width, _x, _y, BORDER, INVERSE_BORDER, TEXTURE
 
Fields inherited from class com.jme.scene.Node
children
 
Fields inherited from class com.jme.scene.Spatial
currentStates, defaultStateList, forceCull, forceView, frustrumIntersects, geometricalControllers, lightCombineMode, localRotation, localScale, localTranslation, name, parent, queueDistance, renderQueueMode, renderStateList, textureCombineMode, worldBound, worldRotation, worldScale, worldTranslation, zOrder
 
Constructor Summary
UIButton(java.lang.String name, int x, int y, int width, int height, InputHandler inputHandler, java.lang.String upfile, java.lang.String overfile, java.lang.String downfile, int flags)
          Constructor requires the unique name, the inputhandler with the mouse that will be monitored for hit tests and the 3 files for the states that it will show.
UIButton(java.lang.String name, int x, int y, int width, int height, InputHandler inputHandler, UIColorScheme scheme, int flags)
          Non-image based constructor, use only borders instead
UIButton(java.lang.String name, int x, int y, int width, int height, InputHandler inputHandler, UIColorScheme scheme, java.lang.String upfile, java.lang.String overfile, java.lang.String downfile, int flags, boolean useClassloader)
          Difference allows for the images to be loaded directly from the file system instead of via the classloader
 
Method Summary
 void setText(UIFonts fonts, java.lang.String fontName, java.lang.String text)
           
 boolean update(float time)
          Needs to be called during the update cycle to allow for the mouse to be checked for hit test and mouse button state.
 
Methods inherited from class com.jme.ui.UIActiveObject
addAction, centerAt, fireActions, getState, hitTest, removeAction, setAltBorderColors, setBaseBorderColors, setBaseColors, setHighlightColors, setLocation
 
Methods inherited from class com.jme.ui.UIObject
getHeight, getWidth, setup, usingBorders, usingInverseBorder, usingStdBorder, usingTexture
 
Methods inherited from class com.jme.scene.Node
applyRenderState, attachChild, detachAllChildren, detachChild, detachChildAt, detachChildNamed, draw, drawBounds, findCollisions, findPick, getChild, getChild, getChildren, getQuantity, hasChild, hasCollision, putClone, setChild, setForceView, updateCollisionTree, updateWorldBound, updateWorldData
 
Methods inherited from class com.jme.scene.Spatial
addController, applyDefaultStates, calculateCollisions, calculatePick, clearCurrentState, clearCurrentStates, clearRenderState, getController, getControllers, getCurrentState, getLastFrustumIntersection, getLightCombineMode, getLocalRotation, getLocalScale, getLocalTranslation, getName, getParent, getRenderQueueMode, getRenderStateList, getTextureCombineMode, getWorldBound, getWorldRotation, getWorldScale, getWorldTranslation, getZOrder, isForceCulled, isForceView, onDraw, onDrawBounds, propagateBoundToRoot, propagateStatesFromRoot, removeController, removeFromParent, setForceCull, setLightCombineMode, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalTranslation, setName, setParent, setRenderQueueMode, setRenderState, setTextureCombineMode, setWorldBound, setZOrder, toString, updateGeometricState, updateRenderState, updateRenderState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UIButton

public UIButton(java.lang.String name,
                int x,
                int y,
                int width,
                int height,
                InputHandler inputHandler,
                java.lang.String upfile,
                java.lang.String overfile,
                java.lang.String downfile,
                int flags)
Constructor requires the unique name, the inputhandler with the mouse that will be monitored for hit tests and the 3 files for the states that it will show. The states may be up, over and down. Up is the steady state. Over, is used for when the mouse is over the button. Down is when the left mouse button is down and the mouse is over the button.

Parameters:
name -
x -
y -
inputHandler -
upfile -
overfile -
downfile -

UIButton

public UIButton(java.lang.String name,
                int x,
                int y,
                int width,
                int height,
                InputHandler inputHandler,
                UIColorScheme scheme,
                int flags)
Non-image based constructor, use only borders instead


UIButton

public UIButton(java.lang.String name,
                int x,
                int y,
                int width,
                int height,
                InputHandler inputHandler,
                UIColorScheme scheme,
                java.lang.String upfile,
                java.lang.String overfile,
                java.lang.String downfile,
                int flags,
                boolean useClassloader)
Difference allows for the images to be loaded directly from the file system instead of via the classloader

Method Detail

update

public boolean update(float time)
Needs to be called during the update cycle to allow for the mouse to be checked for hit test and mouse button state.

Specified by:
update in class UIActiveObject
Returns:

setText

public void setText(UIFonts fonts,
                    java.lang.String fontName,
                    java.lang.String text)