public class TextBox extends UiElement implements Actionable, FlexUiElement
UiElement
. Can optionally function as a password field.Modifier and Type | Field and Description |
---|---|
protected TextBoxRenderNode |
renderNode |
deferredLayout, deferredRender, deferredUpdate, effects, styleId, visibility, zIndex
Constructor and Description |
---|
TextBox()
Constructor.
|
TextBox(float x,
float y,
float width,
float height)
Constructor
|
TextBox(java.lang.String id)
Constructor
|
TextBox(java.lang.String id,
float x,
float y,
float width,
float height)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(ActionListener listener) |
void |
addTextInputListener(TextInputListener listener) |
void |
attach(ParentRenderNode<?,?> parentRenderNode)
Attaches a
RenderNode for this element to a parent
RenderNode |
void |
detach(ParentRenderNode<?,?> parentRenderNode)
Detaches this element's
RenderNode from a parent
RenderNode |
java.lang.String |
getFlexLayout()
Returns the currently used flex layout
|
int |
getRenderHeight()
Returns the height this element is currently rendering at
|
int |
getRenderWidth()
Returns the width this element is currently rendering at
|
int |
getRenderX()
Returns X coordinate of where this element is currently rendering
|
int |
getRenderY()
Returns Y coordinate of where this element is currently rendering
|
StyleRule |
getStyleRule() |
java.lang.String |
getValue()
Returns the text value entered into this
TextBox |
boolean |
grabInput(UiContainer uiContainer)
Grabs the input as if the player clicked/selected this element
|
void |
invokeBeginHover()
Triggers the begin hover event
|
void |
invokeEndHover()
Triggers the end hover event
|
boolean |
isEnabled() |
boolean |
isFlexLayout()
Returns if this
UiElement is using a flex layout |
boolean |
isInitialLayoutOccurred() |
boolean |
isInitialUpdateOccurred() |
boolean |
isPasswordField()
Returns if this
TextBox is a password field |
boolean |
isRenderNodeDirty() |
void |
notifyActionListenersOfBeginEvent(EventTrigger eventTrigger,
EventTriggerParams eventTriggerParams) |
void |
notifyActionListenersOfEndEvent(EventTrigger eventTrigger,
EventTriggerParams eventTriggerParams) |
boolean |
notifyTextInputListeners(char c) |
void |
removeActionListener(ActionListener listener) |
void |
removeTextInputListener(TextInputListener listener) |
void |
setEnabled(boolean enabled) |
void |
setFlex(float x,
float y,
float width,
float height)
Equivalent to
UiElement.set(float, float, float, float) for usage with flex layout |
void |
setFlexLayout(java.lang.String flexLayout)
Sets the current flex layout
|
void |
setHeightFlex(float height)
Equivalent to
UiElement.setHeight(float) for usage with flex layout |
void |
setPasswordField(boolean passwordField)
Sets if this
TextBox is a password field |
void |
setRenderNodeDirty() |
void |
setStyleId(java.lang.String styleId)
Sets the style if for this
UiElement |
void |
setValue(java.lang.String value)
Sets the text value entered into this
TextBox |
void |
setVisibility(Visibility visibility)
Sets the current
Visibility of this UiElement |
void |
setWidthFlex(float width)
Equivalent to
UiElement.setWidth(float) for usage with flex layout |
void |
setXFlex(float x)
Equivalent to
UiElement.setX(float) for usage with flex layout |
void |
setXYFlex(float x,
float y)
Equivalent to
UiElement.setXY(float, float) for usage with flex layout |
void |
setYFlex(float y)
Equivalent to
UiElement.setY(float) for usage with flex layout |
void |
setZIndex(int zIndex)
Sets the Z index of this
UiElement . |
void |
syncWithUpdate(UiContainerRenderTree rootNode)
Syncs data between the
UiElement and RenderNode during update |
addEffectListener, addHoverListener, addNodeStateListener, alignAbove, alignBelow, alignEdgeToEdge, alignLeftOf, alignRightOf, applyEffect, deferUntilLayout, deferUntilLayout, deferUntilRender, deferUntilRender, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, deferUntilUpdate, equals, getContentHeight, getContentWidth, getElementById, getHeight, getId, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getStyleId, getVisibility, getWidth, getX, getY, getZIndex, hashCode, isDebugEnabled, isInitialised, notifyEffectListenersOnFinished, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, notifyNodeStateListeners, removeEffectListener, removeHoverListener, removeNodeStateListener, set, setContentHeight, setContentWidth, setDebugEnabled, setHeight, setHeightToContentHeightOf, setHeightToHeightOf, setWidth, setWidthToContentWidthOf, setWidthToWidthOf, setX, setXY, setY, snapTo, snapTo, syncWithLayout, syncWithRender
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addHoverListener, getId, notifyHoverListenersOnBeginHover, notifyHoverListenersOnEndHover, removeHoverListener
protected TextBoxRenderNode renderNode
public TextBox()
TextBox
public TextBox(java.lang.String id)
id
- The unique ID for this TextBox
public TextBox(float x, float y, float width, float height)
x
- The x coordinate of this element relative to its parenty
- The y coordinate of this element relative to its parentwidth
- The width of this elementheight
- The height of this elementpublic TextBox(java.lang.String id, float x, float y, float width, float height)
id
- The unique ID for this element (if null an ID will be generated)x
- The x coordinate of this element relative to its parenty
- The y coordinate of this element relative to its parentwidth
- The width of this elementheight
- The height of this elementpublic void attach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
for this element to a parent
RenderNode
attach
in class UiElement
parentRenderNode
- The parent RenderNode
to attach topublic void detach(ParentRenderNode<?,?> parentRenderNode)
UiElement
RenderNode
from a parent
RenderNode
detach
in class UiElement
parentRenderNode
- The parent RenderNode
to detach frompublic void invokeBeginHover()
Hoverable
invokeBeginHover
in interface Hoverable
public void invokeEndHover()
Hoverable
invokeEndHover
in interface Hoverable
public void setVisibility(Visibility visibility)
UiElement
Visibility
of this UiElement
setVisibility
in class UiElement
visibility
- The Visibility
to setpublic void setStyleId(java.lang.String styleId)
UiElement
UiElement
setStyleId
in class UiElement
styleId
- The style id to setpublic void syncWithUpdate(UiContainerRenderTree rootNode)
UiElement
UiElement
and RenderNode
during updatesyncWithUpdate
in class UiElement
public java.lang.String getValue()
TextBox
String
by defaultpublic void setValue(java.lang.String value)
TextBox
value
- A non-null String
public boolean isPasswordField()
TextBox
is a password fieldpublic void setPasswordField(boolean passwordField)
TextBox
is a password fieldpasswordField
- True if characters should be hidden by * characterspublic void notifyActionListenersOfBeginEvent(EventTrigger eventTrigger, EventTriggerParams eventTriggerParams)
notifyActionListenersOfBeginEvent
in interface Actionable
public void notifyActionListenersOfEndEvent(EventTrigger eventTrigger, EventTriggerParams eventTriggerParams)
notifyActionListenersOfEndEvent
in interface Actionable
public void addActionListener(ActionListener listener)
addActionListener
in interface Actionable
public void removeActionListener(ActionListener listener)
removeActionListener
in interface Actionable
public void addTextInputListener(TextInputListener listener)
public void removeTextInputListener(TextInputListener listener)
public boolean notifyTextInputListeners(char c)
public boolean grabInput(UiContainer uiContainer)
uiContainer
- The UiContainer
the TextBox
belongs topublic boolean isEnabled()
isEnabled
in interface Actionable
public void setEnabled(boolean enabled)
setEnabled
in interface Actionable
public void setZIndex(int zIndex)
UiElement
UiElement
. Elements will be rendered on
different Z layers in ascending Z order (negatives values first, positive values last)public StyleRule getStyleRule()
getStyleRule
in class UiElement
public java.lang.String getFlexLayout()
FlexUiElement
getFlexLayout
in interface FlexUiElement
public void setFlexLayout(java.lang.String flexLayout)
FlexUiElement
setFlexLayout
in interface FlexUiElement
flexLayout
- see: FlexLayoutRuleset
public boolean isRenderNodeDirty()
isRenderNodeDirty
in class UiElement
public void setRenderNodeDirty()
setRenderNodeDirty
in class UiElement
public boolean isInitialLayoutOccurred()
isInitialLayoutOccurred
in class UiElement
public boolean isInitialUpdateOccurred()
isInitialUpdateOccurred
in class UiElement
public int getRenderX()
UiElement
getRenderX
in class UiElement
Integer.MIN_VALUE
if not renderingpublic int getRenderY()
UiElement
getRenderY
in class UiElement
Integer.MIN_VALUE
if not renderingpublic int getRenderWidth()
UiElement
getRenderWidth
in class UiElement
public int getRenderHeight()
UiElement
getRenderHeight
in class UiElement
public boolean isFlexLayout()
UiElement
UiElement
is using a flex layoutisFlexLayout
in interface FlexUiElement
isFlexLayout
in class UiElement
public void setFlex(float x, float y, float width, float height)
UiElement.set(float, float, float, float)
for usage with flex layoutx
- The x coordinate (in pixels) relative to its parenty
- The y coordinate (in pixels) relative to its parentwidth
- The width in pixelsheight
- The height in pixelspublic void setXYFlex(float x, float y)
UiElement.setXY(float, float)
for usage with flex layoutx
- The x coordinate (in pixels) relative to its parenty
- The y coordinate (in pixels) relative to its parentpublic void setXFlex(float x)
UiElement.setX(float)
for usage with flex layoutx
- The x coordinate (in pixels) relative to its parentpublic void setYFlex(float y)
UiElement.setY(float)
for usage with flex layouty
- The y coordinate (in pixels) relative to its parentpublic void setWidthFlex(float width)
UiElement.setWidth(float)
for usage with flex layoutwidth
- The width in pixelspublic void setHeightFlex(float height)
UiElement.setHeight(float)
for usage with flex layoutheight
- The height in pixels