Package com.ardor3d.extension.ui
Class UISlider
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.extension.ui.UIComponent
com.ardor3d.extension.ui.UIContainer
com.ardor3d.extension.ui.UISlider
- All Implemented Interfaces:
UIKeyHandler
,Hintable
,Savable
A widget allowing display and control of a choice from a range of values.
-
Field Summary
Fields inherited from class com.ardor3d.extension.ui.UIContainer
_textureRenderer, STANDIN_TEXTURE_SIZE
Fields inherited from class com.ardor3d.extension.ui.UIComponent
_tooltipPopTime, _tooltipText, DEFAULT_FOREGROUND_COLOR
Fields inherited from class com.ardor3d.scenegraph.Spatial
_controllers, _delegateMap, _dirtyMark, _frustumIntersects, _listener, _localTransform, _name, _parent, _queueDistance, _renderStateList, _sceneHints, _userData, _worldBound, _worldTransform, ON_DIRTY_ATTACHED, ON_DIRTY_BOUNDING, ON_DIRTY_RENDERSTATE, ON_DIRTY_TRANSFORM, ON_DIRTY_TRANSFORM_ONLY
-
Constructor Summary
ConstructorDescriptionUISlider
(Orientation orientation) create a slider widget with a default range of [0,100].UISlider
(Orientation orientation, int minValue, int maxValue, int initialValue) create a slider widget with a default range of [minValue,maxOffset] and the given initialValue. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionListener
(ActionListener listener) Add the specified listener to this slider's list of listeners notified when it has changed.void
Notifies any listeners that this slider has updated its value.getKnob()
getModel()
getUIComponent
(int x, int y) int
getValue()
boolean
void
layout()
Override this to perform actual layout.boolean
removeActionListener
(ActionListener listener) Remove a listener from this slider's list of listeners.void
setEnabled
(boolean enabled) void
setModel
(DefaultSliderModel model) void
setSnapToValues
(boolean snap) void
setValue
(int value) Set the value on this slidervoid
Ask this component to update its minimum allowed size, based on its contents.Methods inherited from class com.ardor3d.extension.ui.UIContainer
add, attachedToHud, clearStandin, contains, contains, detachAllChildren, detachedFromHud, draw, drawComponent, fireComponentDirty, fireStyleChanged, getLayout, getMinificationFilter, isDirty, isDoClip, isDrawingStandin, isUseStandin, remove, removeAllComponents, setDirty, setDoClip, setLayout, setMinificationFilter, setUseStandin
Methods inherited from class com.ardor3d.extension.ui.UIComponent
addFontStyle, applySkin, cancelTooltipTimer, centerOn, centerOn, clearFontStyle, clearMaximumContentSize, clearMinimumContentSize, compact, fitComponentIn, gainedFocus, getBackdrop, getBorder, getCombinedOpacity, getContentHeight, getContentWidth, getCurrentOpacity, getDefaultFontFamily, getDefaultFontSize, getDefaultFontStyles, getFontStyles, getForegroundColor, getHud, getHudX, getHudY, getKeyFocusTarget, getLayoutData, getLocalComponentHeight, getLocalComponentWidth, getLocalFontStyles, getLocalForegroundColor, getLocalOpacity, getLocalX, getLocalY, getMargin, getMaximumContentHeight, getMaximumContentWidth, getMaximumLocalComponentHeight, getMaximumLocalComponentWidth, getMinimumContentHeight, getMinimumContentWidth, getMinimumLocalComponentHeight, getMinimumLocalComponentWidth, getPadding, getRelativeComponentBounds, getRelativeMaxComponentBounds, getRelativeMinComponentBounds, getTooltipPopTime, getTooltipText, getTopLevelComponent, getTotalBottom, getTotalLeft, getTotalRight, getTotalTop, hasVirginContentArea, insideMargin, isAttachedToHUD, isConsumeKeyEvents, isConsumeMouseEvents, isEnabled, isUseTransparency, isVisible, keyHeld, keyPressed, keyReleased, lostFocus, mouseClicked, mouseDeparted, mouseEntered, mouseMoved, mousePressed, mouseReleased, mouseWheel, pack, postdrawComponent, predrawComponent, requestFocus, setBackdrop, setBorder, setConsumeKeyEvents, setConsumeMouseEvents, setContentHeight, setContentSize, setContentWidth, setDefaultFontFamily, setDefaultFontSize, setDefaultFontStyles, setFontStyles, setForegroundColor, setHudX, setHudXY, setHudY, setKeyFocusTarget, setLayoutData, setLayoutMinimumContentSize, setLocalComponentHeight, setLocalComponentSize, setLocalComponentWidth, setLocalX, setLocalXY, setLocalY, setMargin, setMaximumContentHeight, setMaximumContentSize, setMaximumContentWidth, setMinimumContentHeight, setMinimumContentSize, setMinimumContentWidth, setOpacity, setPadding, setTooltipPopTime, setTooltipText, setUseTransparency, setVirginContentArea, setVisible, updateWorldTransform, updateWorldTransform, validateContentSize
Methods inherited from class com.ardor3d.scenegraph.Node
acceptVisitor, attachChild, attachChildAt, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getClassTag, getNumberOfChildren, hasChild, makeCopy, makeInstanced, propagateDirtyDown, read, sortLights, swapChildren, updateChildren, updateWorldBound, updateWorldRenderStates, write
Methods inherited from class com.ardor3d.scenegraph.Spatial
addController, addTranslation, addTranslation, applyWorldRenderStates, clearControllers, clearDirty, clearDirty, clearRenderState, getController, getControllerCount, getControllers, getCurrentRenderDelegate, getLastFrustumIntersection, getListener, getLocalLastFrustumIntersection, getLocalRenderState, getLocalRenderStates, getName, getParent, getParentHintable, getRenderDelegate, getRotation, getScale, getSceneHints, getTransform, getTranslation, getUserData, getWorldBound, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, isDirty, localToWorld, markDirty, markDirty, onDraw, propagateBoundToRoot, propagateDirtyUp, propagateStatesFromRoot, propageEventUp, removeController, removeController, removeFromParent, setLastFrustumIntersection, setListener, setName, setParent, setRenderDelegate, setRenderState, setRotation, setRotation, setScale, setScale, setScale, setTransform, setTranslation, setTranslation, setUserData, setWorldRotation, setWorldRotation, setWorldScale, setWorldScale, setWorldScale, setWorldTransform, setWorldTranslation, setWorldTranslation, toString, updateControllers, updateGeometricState, updateGeometricState, updateWorldRenderStates, worldToLocal
-
Constructor Details
-
UISlider
create a slider widget with a default range of [0,100]. Initial value is 50.- Parameters:
orientation
- the orientation of the slider (Orientation.Horizontal or Orientation.Vertical)
-
UISlider
create a slider widget with a default range of [minValue,maxOffset] and the given initialValue.- Parameters:
orientation
- the orientation of the slider (Orientation.Horizontal or Orientation.Vertical)minValue
- the minimum value the slider can take (inclusive).maxValue
- the maximum value the slider can take (inclusive). Must be greater than or equal to minValue.initialValue
- the starting value of the slider. Must be between min and max values.
-
-
Method Details
-
fireChangeEvent
public void fireChangeEvent()Notifies any listeners that this slider has updated its value. -
getOrientation
- Returns:
- our orientation.
-
layout
public void layout()Description copied from class:UIComponent
Override this to perform actual layout.- Overrides:
layout
in classUIContainer
-
getUIComponent
- Overrides:
getUIComponent
in classUIContainer
- Parameters:
x
- the x screen coordinatey
- the y screen coordinate- Returns:
- this component (or an appropriate child coordinate in the case of a container) if the given screen coordinates fall inside the margin area of this component.
-
updateMinimumSizeFromContents
public void updateMinimumSizeFromContents()Description copied from class:UIComponent
Ask this component to update its minimum allowed size, based on its contents.- Overrides:
updateMinimumSizeFromContents
in classUIContainer
-
setValue
public void setValue(int value) Set the value on this slider- Parameters:
value
- the new value. Clamps between min and max values.
-
getValue
public int getValue()- Returns:
- the current data model's current value.
-
getModel
- Returns:
- the data model for the slider.
-
setModel
- Parameters:
model
- the new data model for this slider. Must not be null.
-
addActionListener
Add the specified listener to this slider's list of listeners notified when it has changed.- Parameters:
listener
- the listener to add
-
removeActionListener
Remove a listener from this slider's list of listeners.- Parameters:
listener
- the listener to remove- Returns:
- true if the listener was removed.
-
setEnabled
public void setEnabled(boolean enabled) - Overrides:
setEnabled
in classUIComponent
- Parameters:
enabled
- true if this component should be considered "enabled"... a concept that is interpreted by each individual component type.
-
getKnob
- Returns:
- the knob associated with this slider.
-
getBackPanel
- Returns:
- the back panel associated with this slider.
-
setSnapToValues
public void setSnapToValues(boolean snap) - Parameters:
snap
- true if we snap the slider to the integer representations on mouse release.
-
isSnapToValues
public boolean isSnapToValues()- Returns:
- true if we snap the slider to the integer representations on mouse release.
-