Package com.simsilica.lemur.component
Class TextEntryComponent
java.lang.Object
com.simsilica.lemur.component.AbstractGuiComponent
com.simsilica.lemur.component.TextEntryComponent
- All Implemented Interfaces:
ColoredComponent
,GuiComponent
,FocusTarget
public class TextEntryComponent
extends AbstractGuiComponent
implements FocusTarget, ColoredComponent
A basic text entry component that allows displaying and editing of
text based on a DocumentModel. Default key bindings are setup for
common navigation functions and the key input is taken over while the
component has focus.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
static final KeyActionListener
-
Constructor Summary
ConstructorsConstructorDescriptionTextEntryComponent
(BitmapFont font) TextEntryComponent
(DocumentModel model, BitmapFont font) -
Method Summary
Modifier and TypeMethodDescriptionvoid
attach
(GuiControl parent) void
clone()
void
detach
(GuiControl parent) void
Notifies this focus target that is has gained focus.void
Notifies this focus target that is has lost focus.float
getAlpha()
Returns the current alpha multiplier that is applied to the color when set to the actual visuals.getColor()
Returns the current color of this component.float
getFont()
float
float
float
getText()
protected float
getVisibleWidth
(String text) boolean
Returns true if this target can currently accept focus through a normal transition.boolean
Returns true if this focus target currently has the focus.boolean
protected void
protected void
protected void
protected void
protected void
void
protected void
void
setAlpha
(float f) Sets an alpha multiplier that will be applied to the color when set to the actual visuals.void
Sets the color for this component.void
setFont
(BitmapFont font) void
setFontSize
(float f) void
void
void
setPreferredLineCount
(int i) void
void
setPreferredWidth
(float f) void
setSingleLine
(boolean f) void
void
Methods inherited from class com.simsilica.lemur.component.AbstractGuiComponent
getGuiControl, getNode, invalidate, isAttached
-
Field Details
-
DOC_HOME
-
DOC_END
-
LINE_HOME
-
LINE_END
-
PREV_LINE
-
NEXT_LINE
-
LEFT
-
RIGHT
-
NO_OP
-
BACKSPACE
-
NEW_LINE
-
DELETE
-
RELEASE_FOCUS
-
FOCUS_NEXT
-
FOCUS_PREVIOUS
-
FOCUS_DOWN
-
FOCUS_UP
-
-
Constructor Details
-
TextEntryComponent
-
TextEntryComponent
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceGuiComponent
- Overrides:
clone
in classAbstractGuiComponent
-
attach
- Specified by:
attach
in interfaceGuiComponent
- Overrides:
attach
in classAbstractGuiComponent
-
detach
- Specified by:
detach
in interfaceGuiComponent
- Overrides:
detach
in classAbstractGuiComponent
-
isFocused
public boolean isFocused()Description copied from interface:FocusTarget
Returns true if this focus target currently has the focus.- Specified by:
isFocused
in interfaceFocusTarget
-
isFocusable
public boolean isFocusable()Description copied from interface:FocusTarget
Returns true if this target can currently accept focus through a normal transition. If an attempt is made to force the focus to this target then focus may actually transition to a different target.- Specified by:
isFocusable
in interfaceFocusTarget
-
focusGained
public void focusGained()Description copied from interface:FocusTarget
Notifies this focus target that is has gained focus.- Specified by:
focusGained
in interfaceFocusTarget
-
focusLost
public void focusLost()Description copied from interface:FocusTarget
Notifies this focus target that is has lost focus.- Specified by:
focusLost
in interfaceFocusTarget
-
getActionMap
-
getDocumentModel
-
setSingleLine
public void setSingleLine(boolean f) -
isSingleLine
public boolean isSingleLine() -
setFont
-
getFont
-
setFontSize
public void setFontSize(float f) -
getFontSize
public float getFontSize() -
resetCursorColor
protected void resetCursorColor() -
setColor
Description copied from interface:ColoredComponent
Sets the color for this component.- Specified by:
setColor
in interfaceColoredComponent
-
getColor
Description copied from interface:ColoredComponent
Returns the current color of this component.- Specified by:
getColor
in interfaceColoredComponent
-
setAlpha
public void setAlpha(float f) Description copied from interface:ColoredComponent
Sets an alpha multiplier that will be applied to the color when set to the actual visuals.- Specified by:
setAlpha
in interfaceColoredComponent
-
getAlpha
public float getAlpha()Description copied from interface:ColoredComponent
Returns the current alpha multiplier that is applied to the color when set to the actual visuals.- Specified by:
getAlpha
in interfaceColoredComponent
-
resetText
protected void resetText() -
getVisibleWidth
-
setPreferredCursorWidth
-
getPreferredCursorWidth
-
getCursorWidth
public float getCursorWidth() -
resizeCursor
protected void resizeCursor() -
resetCursorState
protected void resetCursorState() -
resetCursorPosition
protected void resetCursorPosition() -
setText
-
getText
-
setHAlignment
-
getHAlignment
-
setVAlignment
-
getVAlignment
-
setPreferredSize
-
getPreferredSize
-
setPreferredWidth
public void setPreferredWidth(float f) -
getPreferredWidth
public float getPreferredWidth() -
setPreferredLineCount
public void setPreferredLineCount(int i) -
getPreferredLineCount
public float getPreferredLineCount() -
reshape
- Specified by:
reshape
in interfaceGuiComponent
-
calculatePreferredSize
- Specified by:
calculatePreferredSize
in interfaceGuiComponent
-
resetAlignment
protected void resetAlignment()
-