Package com.ardor3d.extension.ui
Class UIComponent
java.lang.Object
com.ardor3d.scenegraph.Spatial
com.ardor3d.scenegraph.Node
com.ardor3d.extension.ui.UIComponent
- All Implemented Interfaces:
UIKeyHandler
,Hintable
,Savable
- Direct Known Subclasses:
StateBasedUIComponent
,UIContainer
,UIState
Base UI class. All UI components/widgets/controls extend this class.
TODO: alert/dirty needed for font style changes.
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The amount of time (in ms) before we should show the tooltip on this component.protected String
Text to display using UITooltip when hovered over.static ReadOnlyColorRGBA
WhiteFields 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addFontStyle
(String styleKey, Object styleValue) Add a new font style to this component.protected void
void
Override to provide an action to take when this component or its top level component are attached to a UIHud.protected void
Check if our tooltip timer is active and cancel it.void
centerOn
(UIComponent comp) Centers this component on the location of the given component.void
Centers this frame on the view of the cameraclearFontStyle
(String styleKey) Removes a font style locally from this component, if present.void
void
void
compact()
Sets the size of the content area of this component to the current width and height set on _minimumContentsSize (if component is set to allow such resizing.)void
Override to provide an action to take just before this component or its top level component are removed from a UIHud.void
draw
calls the onDraw method for each child maintained by this node.protected void
drawComponent
(Renderer renderer) Draw this component's contents using the given renderer.void
Tell all ancestors that use standins, if any, that they need to update any cached graphical representation.void
Let subcomponents know that style has been changed.void
fitComponentIn
(int width, int height) Attempt to force this component to fit in the given rectangle.void
Called by the hud when a component is given focus.float
int
int
static float
static String
static int
getHud()
int
getHudX()
int
getHudY()
int
int
float
int
int
protected int
protected int
int
int
protected int
protected int
int
int
int
int
int
int
int
getUIComponent
(int hudX, int hudY) boolean
Used primarily during rendering to determine how alpha blending should be done.boolean
insideMargin
(int hudX, int hudY) boolean
boolean
boolean
boolean
static boolean
boolean
boolean
keyHeld
(Key key, InputState state) Called when this component has focus and a key is held down over more than 1 input cycle.boolean
keyPressed
(Key key, InputState state) Called when this component has focus and a key is pressed.boolean
keyReleased
(Key key, InputState state) Called when this component has focus and a key is released.void
layout()
Override this to perform actual layout.void
Called by the hud when a component loses focus.boolean
mouseClicked
(MouseButton button, InputState state) Called when a mouse button is pressed and released in close proximity while the cursor is over this component.void
mouseDeparted
(int mouseX, int mouseY, InputState state) Called when a mouse cursor leaves this component.void
mouseEntered
(int mouseX, int mouseY, InputState state) Called when a mouse cursor enters this component.boolean
mouseMoved
(int mouseX, int mouseY, InputState state) Called when a mouse is moved while the cursor is over this component.boolean
mousePressed
(MouseButton button, InputState state) Called when a mouse button is pressed while the cursor is over this component.boolean
mouseReleased
(MouseButton button, InputState state) Called when a mouse button is released while the cursor is over this component.boolean
mouseWheel
(int wheelDx, InputState state) Called when the mouse wheel is moved while the cursor is over this component.void
pack()
Resize the container to fit the minimum size of its content panel.protected void
postdrawComponent
(Renderer renderer) Perform any post-draw operations on this component.protected void
predrawComponent
(Renderer renderer) Perform any pre-draw operations on this component.void
Looks up the scenegraph for a Hud and asks it to set us as the currently focused component.void
setBackdrop
(UIBackdrop backDrop) void
void
setConsumeKeyEvents
(boolean consume) void
setConsumeMouseEvents
(boolean consume) void
setContentHeight
(int height) Sets the height of the content area of this component to that given, as long as we're between min and max content height.void
setContentSize
(int width, int height) Sets the width and height of the content area of this component.void
setContentWidth
(int width) Sets the width of the content area of this component to that given, as long as we're between min and max content width.static void
setDefaultFontFamily
(String family) static void
setDefaultFontSize
(int size) static void
setDefaultFontStyles
(Map<String, Object> defaultStyles) void
setEnabled
(boolean enabled) void
setFontStyles
(Map<String, Object> styles) void
void
setHudX
(int x) void
setHudXY
(int x, int y) Sets the screen x,y coordinate of this component's origin (usually its lower left corner.)void
setHudY
(int y) void
setKeyFocusTarget
(UIComponent target) void
setLayoutData
(UILayoutData layoutData) void
setLayoutMinimumContentSize
(int width, int height) Sets the minimum content size of this component to the values given.void
setLocalComponentHeight
(int height) Sets the current component height to that given, as long as it would not violate min and max content height.void
setLocalComponentSize
(int width, int height) Sets the width and height of this component by forcing the content area to be of a proper size such that when the padding, margin and border are added, the total component size match those given.void
setLocalComponentWidth
(int width) Sets the current component width to that given, as long as it would not violate min and max content width.void
setLocalX
(int x) Set the x translation from the lower left corner of our parent's content area to the origin of this component.void
setLocalXY
(int x, int y) Set the x,y translation from the lower left corner of our parent's content area to the origin of this component.void
setLocalY
(int y) Set the y translation from the lower left corner of our parent's content area to the origin of this component.void
void
setMaximumContentHeight
(int height) Sets the maximum content height of this component to the value given.void
setMaximumContentSize
(int width, int height) Sets the maximum content size of this component to the values given.void
setMaximumContentWidth
(int width) Sets the maximum content width of this component to the value given.void
setMinimumContentHeight
(int height) Sets the minimum content height of this component to the value given.void
setMinimumContentSize
(int width, int height) Sets the minimum content size of this component to the values given.void
setMinimumContentWidth
(int width) Sets the minimum content width of this component to the value given.void
setOpacity
(float opacity) Set the opacity level of this component.void
setPadding
(Insets padding) void
setTooltipPopTime
(int ms) void
setTooltipText
(String text) static void
setUseTransparency
(boolean useTransparency) void
setVirginContentArea
(boolean virgin) void
setVisible
(boolean visible) protected void
Ask this component to update its minimum allowed size, based on its contents.void
updateWorldTransform
(boolean recurse) Updates the worldTransform.protected void
updateWorldTransform
(boolean recurse, boolean self) Allow skipping updating our own world transform.protected void
Ensures content size is between min and max.Methods inherited from class com.ardor3d.scenegraph.Node
acceptVisitor, attachChild, attachChildAt, detachAllChildren, 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
-
Field Details
-
DEFAULT_FOREGROUND_COLOR
White -
_tooltipText
Text to display using UITooltip when hovered over. Inherited from parent if null. -
_tooltipPopTime
protected int _tooltipPopTimeThe amount of time (in ms) before we should show the tooltip on this component.
-
-
Constructor Details
-
UIComponent
public UIComponent()
-
-
Method Details
-
applySkin
protected void applySkin() -
isEnabled
public boolean isEnabled()- Returns:
- true if this component should be considered "enabled"... a concept that is interpreted by each individual component type.
-
setEnabled
public void setEnabled(boolean enabled) - Parameters:
enabled
- true if this component should be considered "enabled"... a concept that is interpreted by each individual component type.
-
isVisible
public boolean isVisible()- Returns:
- true if this component should be drawn.
-
setVisible
public void setVisible(boolean visible) - Parameters:
visible
- true if this component should be drawn.
-
hasVirginContentArea
public boolean hasVirginContentArea()Used primarily during rendering to determine how alpha blending should be done.- Returns:
- true if nothing has been drawn by this component or its ancestors yet that would affect its content area.
-
setVirginContentArea
public void setVirginContentArea(boolean virgin) - Parameters:
virgin
- true if nothing has been drawn by this component yet that would affect its content area.
-
addFontStyle
Add a new font style to this component. Will be inherited by children if they do not have the same key.- Parameters:
styleKey
- style keystyleValue
- the value to associate with the key.
-
clearFontStyle
Removes a font style locally from this component, if present.- Parameters:
styleKey
- style key- Returns:
- the style value we were mapped to, or null if none (or was mapped to null).
-
getLocalFontStyles
- Returns:
- the locally set font styles.
-
getFontStyles
- Returns:
- our combined font styles, merged downward from root, including defaults.
-
setFontStyles
- Parameters:
styles
- the font styles to use (as needed) for this component. Note that this can be inherited by child components if this is a container class and styles is null.
-
getLayoutData
- Returns:
- the set layout data object or null if none has been set.
-
setLayoutData
- Parameters:
layoutData
- the layout data object set on this component. The object would provide specific layout directions to the layout class of the container this component is placed in.
-
getLocalComponentWidth
public int getLocalComponentWidth()- Returns:
- the width of this entire component as a whole, including all margins, borders, padding and content (in the component's coordinate space.)
-
getLocalComponentHeight
public int getLocalComponentHeight()- Returns:
- the height of this entire component as a whole, including all margins, borders, padding and content (in the component's coordinate space.)
-
getRelativeMinComponentBounds
- Parameters:
store
- the object to store our results in. If null, a new Rectangle2 is created and returned.- Returns:
- the relative minimum component bounds
-
getRelativeMaxComponentBounds
- Parameters:
store
- the object to store our results in. If null, a new Rectangle2 is created and returned.- Returns:
- the relative maximum component bounds
-
getRelativeComponentBounds
- Parameters:
store
- the object to store our results in. If null, a new Rectangle2 is created and returned.- Returns:
- the current bounds of this component, in the coordinate space of its parent.
-
setLocalComponentSize
public void setLocalComponentSize(int width, int height) Sets the width and height of this component by forcing the content area to be of a proper size such that when the padding, margin and border are added, the total component size match those given.- Parameters:
width
- the new width of the componentheight
- the new height of the component
-
getMinimumContentWidth
protected int getMinimumContentWidth() -
getMinimumContentHeight
protected int getMinimumContentHeight() -
getMinimumLocalComponentWidth
public int getMinimumLocalComponentWidth()- Returns:
- the width contained in _minimumContentsSize + the margin, border and padding values for left and right.
-
getMinimumLocalComponentHeight
public int getMinimumLocalComponentHeight()- Returns:
- the height contained in _minimumContentsSize + the margin, border and padding values for top and bottom.
-
getMaximumContentWidth
protected int getMaximumContentWidth() -
getMaximumContentHeight
protected int getMaximumContentHeight() -
getMaximumLocalComponentWidth
public int getMaximumLocalComponentWidth()- Returns:
- the width contained in _maximumContentsSize + the margin, border and padding values for left and right.
-
getMaximumLocalComponentHeight
public int getMaximumLocalComponentHeight()- Returns:
- the height contained in _maximumContentsSize + the margin, border and padding values for top and bottom.
-
setContentSize
public void setContentSize(int width, int height) Sets the width and height of the content area of this component.- Parameters:
width
- the new width of the content areaheight
- the new height of the content area
-
setContentHeight
public void setContentHeight(int height) Sets the height of the content area of this component to that given, as long as we're between min and max content height.- Parameters:
height
- the new height
-
setContentWidth
public void setContentWidth(int width) Sets the width of the content area of this component to that given, as long as we're between min and max content width.- Parameters:
width
- the new width
-
setLocalComponentHeight
public void setLocalComponentHeight(int height) Sets the current component height to that given, as long as it would not violate min and max content height.- Parameters:
height
- the new height
-
setLocalComponentWidth
public void setLocalComponentWidth(int width) Sets the current component width to that given, as long as it would not violate min and max content width.- Parameters:
width
- the new width
-
getContentWidth
public int getContentWidth()- Returns:
- the width of the content area of this component.
-
getContentHeight
public int getContentHeight()- Returns:
- the height of the content area of this component.
-
clearMaximumContentSize
public void clearMaximumContentSize() -
setMaximumContentSize
public void setMaximumContentSize(int width, int height) Sets the maximum content size of this component to the values given.- Parameters:
width
- the widthheight
- the height
-
setMaximumContentWidth
public void setMaximumContentWidth(int width) Sets the maximum content width of this component to the value given.- Parameters:
width
- the width
-
setMaximumContentHeight
public void setMaximumContentHeight(int height) Sets the maximum content height of this component to the value given.- Parameters:
height
- the height
-
setLayoutMinimumContentSize
public void setLayoutMinimumContentSize(int width, int height) Sets the minimum content size of this component to the values given.- Parameters:
width
- the widthheight
- the height
-
clearMinimumContentSize
public void clearMinimumContentSize() -
setMinimumContentSize
public void setMinimumContentSize(int width, int height) Sets the minimum content size of this component to the values given.- Parameters:
width
- the widthheight
- the height
-
setMinimumContentWidth
public void setMinimumContentWidth(int width) Sets the minimum content width of this component to the value given.- Parameters:
width
- the width
-
setMinimumContentHeight
public void setMinimumContentHeight(int height) Sets the minimum content height of this component to the value given.- Parameters:
height
- the height
-
isConsumeKeyEvents
public boolean isConsumeKeyEvents() -
setConsumeKeyEvents
public void setConsumeKeyEvents(boolean consume) -
isConsumeMouseEvents
public boolean isConsumeMouseEvents() -
setConsumeMouseEvents
public void setConsumeMouseEvents(boolean consume) -
validateContentSize
protected void validateContentSize()Ensures content size is between min and max. -
compact
public void compact()Sets the size of the content area of this component to the current width and height set on _minimumContentsSize (if component is set to allow such resizing.) -
pack
public void pack()Resize the container to fit the minimum size of its content panel. -
fitComponentIn
public void fitComponentIn(int width, int height) Attempt to force this component to fit in the given rectangle.- Parameters:
width
- the widthheight
- the height
-
layout
public void layout()Override this to perform actual layout. -
getTotalBottom
public int getTotalBottom()- Returns:
- the sum of the bottom side of this component's margin, border and padding (if they are set).
-
getTotalTop
public int getTotalTop()- Returns:
- the sum of the top side of this component's margin, border and padding (if they are set).
-
getTotalLeft
public int getTotalLeft()- Returns:
- the sum of the left side of this component's margin, border and padding (if they are set).
-
getTotalRight
public int getTotalRight()- Returns:
- the sum of the right side of this component's margin, border and padding (if they are set).
-
getBorder
- Returns:
- the current border set on this component, if any.
-
setBorder
- Parameters:
border
- the border we wish this component to use. May be null.
-
getBackdrop
- Returns:
- the current backdrop set on this component, if any.
-
setBackdrop
- Parameters:
backDrop
- the backdrop we wish this component to use. May be null.
-
getMargin
- Returns:
- the current margin set on this component, if any.
-
setMargin
- Parameters:
margin
- the new margin (a spacing between the component's border and other components) to set on this component. Copied into the component and is allowed to be null.
-
getPadding
- Returns:
- the current margin set on this component, if any.
-
setPadding
- Parameters:
padding
- the new padding (a spacing between the component's border and its inner content area) to set on this component. Copied into the component and is allowed to be null.
-
isAttachedToHUD
public boolean isAttachedToHUD()- Returns:
- true if our parent is a UIHud.
-
getTopLevelComponent
- Returns:
- the first instance of UIComponent found in this Component's UIComponent ancestry that is attached to the hud, or null if none are found. Returns "this" component if it is directly attached to the hud.
-
getHud
- Returns:
- the first instance of UIHud found in this Component's UIComponent ancestry or null if none are found.
-
attachedToHud
public void attachedToHud()Override to provide an action to take when this component or its top level component are attached to a UIHud. -
detachedFromHud
public void detachedFromHud()Override to provide an action to take just before this component or its top level component are removed from a UIHud. -
centerOn
Centers this frame on the view of the camera- Parameters:
hud
- the hud to center on.
-
centerOn
Centers this component on the location of the given component.- Parameters:
comp
- the component to center on.
-
getHudX
public int getHudX()- Returns:
- current screen x coordinate of this component's origin (usually its lower left corner.)
-
getHudY
public int getHudY()- Returns:
- current screen y coordinate of this component's origin (usually its lower left corner.)
-
setHudXY
public void setHudXY(int x, int y) Sets the screen x,y coordinate of this component's origin (usually its lower left corner.)- Parameters:
x
- the new screen x coordinate of this component's origin (usually its lower left corner.)y
- the new screen y coordinate of this component's origin (usually its lower left corner.)
-
setHudX
public void setHudX(int x) - Parameters:
x
- the new screen x coordinate of this component's origin (usually its lower left corner.)
-
setHudY
public void setHudY(int y) - Parameters:
y
- the new screen y coordinate of this component's origin (usually its lower left corner.)
-
getLocalX
public int getLocalX()- Returns:
- a local x translation from the parent component's content area.
-
getLocalY
public int getLocalY()- Returns:
- a local y translation from the parent component's content area.
-
setLocalXY
public void setLocalXY(int x, int y) Set the x,y translation from the lower left corner of our parent's content area to the origin of this component.- Parameters:
x
- the local x translation from the parent component's content areay
- the local y translation from the parent component's content area
-
setLocalX
public void setLocalX(int x) Set the x translation from the lower left corner of our parent's content area to the origin of this component.- Parameters:
x
- the local x translation from the parent component's content area
-
setLocalY
public void setLocalY(int y) Set the y translation from the lower left corner of our parent's content area to the origin of this component.- Parameters:
y
- the local y translation from the parent component's content area
-
getLocalForegroundColor
- Returns:
- the currently set foreground color on this component. Does not inherit from ancestors or default, so may return null.
-
getForegroundColor
- Returns:
- the foreground color associated with this component. If none has been set, we will ask our parent
component and so on. If no component is found in our ancestry with a foreground color, we will use
DEFAULT_FOREGROUND_COLOR
-
setForegroundColor
- Parameters:
color
- the foreground color of this component.
-
getTooltipText
- Returns:
- this component's tooltip text. If none has been set, we will ask our parent component and so on. returns null if no tooltips are found.
-
setTooltipText
- Parameters:
text
- the tooltip text of this component.
-
getTooltipPopTime
public int getTooltipPopTime()- Returns:
- the amount of time in ms to wait before showing a tooltip for this component.
-
setTooltipPopTime
public void setTooltipPopTime(int ms) - Parameters:
ms
- the amount of time in ms to wait before showing a tooltip for this component. This is only granular to a tenth of a second (or 100ms)
-
cancelTooltipTimer
protected void cancelTooltipTimer()Check if our tooltip timer is active and cancel it. -
insideMargin
public boolean insideMargin(int hudX, int hudY) - Parameters:
hudX
- the x screen coordinatehudY
- the y screen coordinate- Returns:
- true if the given screen coordinates fall inside the margin area of this component (or in other words, is at the border level or deeper.)
-
getUIComponent
- Parameters:
hudX
- the x screen coordinatehudY
- 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.
-
updateWorldTransform
public void updateWorldTransform(boolean recurse) Description copied from class:Spatial
Updates the worldTransform.- Overrides:
updateWorldTransform
in classNode
- Parameters:
recurse
- usually false when updating the tree. Set to true when you just want to update the world transforms for a branch without updating geometric state.
-
updateWorldTransform
protected void updateWorldTransform(boolean recurse, boolean self) Allow skipping updating our own world transform.- Parameters:
recurse
-true
if done recursively on all its childrenself
-true
if applied on itself
-
draw
Description copied from class:Node
draw
calls the onDraw method for each child maintained by this node. -
setDefaultFontFamily
- Parameters:
family
- the Font to use as "default" across all UI components that do not have one set.
-
getDefaultFontFamily
- Returns:
- the default Font family. Defaults to "Vera".
-
setDefaultFontSize
public static void setDefaultFontSize(int size) - Parameters:
size
- the Font size to use as "default" across all UI components that do not have one set.
-
getDefaultFontSize
public static int getDefaultFontSize()- Returns:
- the default Font size (height). Defaults to 18.
-
setDefaultFontStyles
- Parameters:
defaultStyles
- the Font styles to use as "default" across all UI components that do not have one set.
-
getDefaultFontStyles
- Returns:
- the default Font styles.
-
getCombinedOpacity
public float getCombinedOpacity()- Returns:
- the opacity level set on this component in [0,1], where 0 means completely transparent and 1 is completely opaque. If useTransparency is false, this will always return 1.
-
getLocalOpacity
public float getLocalOpacity()- Returns:
- the opacity set on this component directly, not accounting for parent opacity levels.
-
setOpacity
public void setOpacity(float opacity) Set the opacity level of this component.- Parameters:
opacity
- value in [0,1], where 0 means completely transparent and 1 is completely opaque.
-
fireComponentDirty
public void fireComponentDirty()Tell all ancestors that use standins, if any, that they need to update any cached graphical representation. -
fireStyleChanged
public void fireStyleChanged()Let subcomponents know that style has been changed. -
isUseTransparency
public static boolean isUseTransparency()- Returns:
- true if all components should use their opacity value to blend against other components (and/or the 3d background scene.)
-
setUseTransparency
public static void setUseTransparency(boolean useTransparency) - Parameters:
useTransparency
- true if all components should use their opacity value to blend against the 3d scene (and each other)
-
getCurrentOpacity
public static float getCurrentOpacity()- Returns:
- the currently rendering component's opacity level. Used by the renderer to alter alpha values based of component elements.
-
updateMinimumSizeFromContents
protected void updateMinimumSizeFromContents()Ask this component to update its minimum allowed size, based on its contents. -
predrawComponent
Perform any pre-draw operations on this component.- Parameters:
renderer
- the renderer
-
postdrawComponent
Perform any post-draw operations on this component.- Parameters:
renderer
- the renderer
-
drawComponent
Draw this component's contents using the given renderer.- Parameters:
renderer
- the renderer
-
mouseEntered
Called when a mouse cursor enters this component.- Parameters:
mouseX
- mouse x coordinate.mouseY
- mouse y coordinate.state
- the current tracked state of the input system.
-
mouseDeparted
Called when a mouse cursor leaves this component.- Parameters:
mouseX
- mouse x coordinate.mouseY
- mouse y coordinate.state
- the current tracked state of the input system.
-
mousePressed
Called when a mouse button is pressed while the cursor is over this component.- Parameters:
button
- the button that was pressedstate
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
mouseReleased
Called when a mouse button is released while the cursor is over this component.- Parameters:
button
- the button that was releasedstate
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
mouseClicked
Called when a mouse button is pressed and released in close proximity while the cursor is over this component.- Parameters:
button
- the button that was releasedstate
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
mouseMoved
Called when a mouse is moved while the cursor is over this component.- Parameters:
mouseX
- mouse x coordinate.mouseY
- mouse y coordinate.state
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
mouseWheel
Called when the mouse wheel is moved while the cursor is over this component.- Parameters:
wheelDx
- the last change of the wheelstate
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
keyPressed
Called when this component has focus and a key is pressed.- Specified by:
keyPressed
in interfaceUIKeyHandler
- Parameters:
key
- the key pressed.state
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
keyHeld
Called when this component has focus and a key is held down over more than 1 input cycle.- Specified by:
keyHeld
in interfaceUIKeyHandler
- Parameters:
key
- the key held.state
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
keyReleased
Called when this component has focus and a key is released.- Specified by:
keyReleased
in interfaceUIKeyHandler
- Parameters:
key
- the key released.state
- the current tracked state of the input system.- Returns:
- true if we want to consider the event "consumed" by the UI system.
-
gainedFocus
public void gainedFocus()Called by the hud when a component is given focus. -
lostFocus
public void lostFocus()Called by the hud when a component loses focus. -
requestFocus
public void requestFocus()Looks up the scenegraph for a Hud and asks it to set us as the currently focused component. -
getKeyFocusTarget
- Returns:
- a component we defer to for key focus. Default is null.
-
setKeyFocusTarget
- Parameters:
target
- a component to set as the actual focused component if this component receives focus.
-