Class TextArea
- java.lang.Object
-
- com.badlogic.gdx.scenes.scene2d.Actor
-
- com.badlogic.gdx.scenes.scene2d.ui.Widget
-
- com.badlogic.gdx.scenes.scene2d.ui.TextField
-
- com.badlogic.gdx.scenes.scene2d.ui.TextArea
-
- All Implemented Interfaces:
Disableable,Layout
public class TextArea extends TextField
A text input field with multiple lines.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classTextArea.TextAreaListenerInput listener for the text area-
Nested classes/interfaces inherited from class com.badlogic.gdx.scenes.scene2d.ui.TextField
TextField.DefaultOnscreenKeyboard, TextField.OnscreenKeyboard, TextField.TextFieldClickListener, TextField.TextFieldFilter, TextField.TextFieldListener, TextField.TextFieldStyle
-
-
Field Summary
-
Fields inherited from class com.badlogic.gdx.scenes.scene2d.ui.TextField
BACKSPACE, BULLET, CARRIAGE_RETURN, cursor, DELETE, displayText, fontOffset, glyphPositions, hasSelection, keyRepeatInitialTime, keyRepeatTime, layout, NEWLINE, selectionStart, TAB, text, textHeight, textOffset, visibleTextEnd, visibleTextStart, writeEnters
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcalculateOffsets()protected booleancontinueCursor(int index, int offset)protected InputListenercreateInputListener()protected voiddrawCursor(Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y)protected voiddrawSelection(Drawable selection, Batch batch, BitmapFont font, float x, float y)Draws selection rectangleprotected voiddrawText(Batch batch, BitmapFont font, float x, float y)intgetCursorLine()floatgetCursorX()floatgetCursorY()intgetFirstLineShowing()intgetLines()Returns total number of lines that the text occupiesintgetLinesShowing()floatgetPrefHeight()protected floatgetTextY(BitmapFont font, Drawable background)protected voidinitialize()protected intletterUnderCursor(float x)protected voidmoveCursor(boolean forward, boolean jump)voidmoveCursorLine(int line)Moves the cursor to the given number linebooleannewLineAtEnd()Returns if there's a new line at then end of the textvoidsetPrefRows(float prefRows)Sets the preferred number of rows (lines) for this text area.voidsetSelection(int selectionStart, int selectionEnd)Sets the selected text.voidsetStyle(TextField.TextFieldStyle style)protected voidsizeChanged()Called when the actor's size has been changed.-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.TextField
appendText, clearSelection, copy, cut, draw, drawMessageText, getAlignment, getBackgroundDrawable, getCursorPosition, getDefaultInputListener, getFocusTraversal, getMaxLength, getMessageText, getOnscreenKeyboard, getPrefWidth, getProgrammaticChangeEvents, getSelection, getSelectionStart, getStyle, getText, getTextFieldFilter, isDisabled, isPasswordMode, isWordCharacter, next, selectAll, setAlignment, setBlinkTime, setClipboard, setCursorPosition, setDisabled, setFocusTraversal, setMaxLength, setMessageText, setOnlyFontChars, setOnscreenKeyboard, setPasswordCharacter, setPasswordMode, setProgrammaticChangeEvents, setText, setTextFieldFilter, setTextFieldListener, wordUnderCursor
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.ui.Widget
getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, invalidate, invalidateHierarchy, layout, needsLayout, pack, setFillParent, setLayoutEnabled, validate
-
Methods inherited from class com.badlogic.gdx.scenes.scene2d.Actor
act, addAction, addCaptureListener, addListener, ancestorsVisible, ascendantsVisible, clear, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, debug, drawDebug, drawDebugBounds, fire, firstAscendant, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasKeyboardFocus, hasParent, hasScrollFocus, hit, isAscendantOf, isDescendantOf, isTouchable, isTouchFocusListener, isTouchFocusTarget, isVisible, localToActorCoordinates, localToAscendantCoordinates, localToParentCoordinates, localToScreenCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, scaleChanged, screenToLocalCoordinates, setBounds, setColor, setColor, setDebug, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setStage, setTouchable, setUserObject, setVisible, setWidth, setX, setX, setY, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront, toString
-
-
-
-
Constructor Detail
-
TextArea
public TextArea(java.lang.String text, Skin skin)
-
TextArea
public TextArea(java.lang.String text, Skin skin, java.lang.String styleName)
-
TextArea
public TextArea(java.lang.String text, TextField.TextFieldStyle style)
-
-
Method Detail
-
initialize
protected void initialize()
- Overrides:
initializein classTextField
-
letterUnderCursor
protected int letterUnderCursor(float x)
- Overrides:
letterUnderCursorin classTextField
-
setStyle
public void setStyle(TextField.TextFieldStyle style)
-
setPrefRows
public void setPrefRows(float prefRows)
Sets the preferred number of rows (lines) for this text area. Used to calculate preferred height
-
getPrefHeight
public float getPrefHeight()
- Specified by:
getPrefHeightin interfaceLayout- Overrides:
getPrefHeightin classTextField
-
getLines
public int getLines()
Returns total number of lines that the text occupies
-
newLineAtEnd
public boolean newLineAtEnd()
Returns if there's a new line at then end of the text
-
moveCursorLine
public void moveCursorLine(int line)
Moves the cursor to the given number line
-
sizeChanged
protected void sizeChanged()
Description copied from class:ActorCalled when the actor's size has been changed.- Overrides:
sizeChangedin classWidget
-
getTextY
protected float getTextY(BitmapFont font, @Null Drawable background)
-
drawSelection
protected void drawSelection(Drawable selection, Batch batch, BitmapFont font, float x, float y)
Description copied from class:TextFieldDraws selection rectangle- Overrides:
drawSelectionin classTextField
-
drawText
protected void drawText(Batch batch, BitmapFont font, float x, float y)
-
drawCursor
protected void drawCursor(Drawable cursorPatch, Batch batch, BitmapFont font, float x, float y)
- Overrides:
drawCursorin classTextField
-
calculateOffsets
protected void calculateOffsets()
- Overrides:
calculateOffsetsin classTextField
-
createInputListener
protected InputListener createInputListener()
- Overrides:
createInputListenerin classTextField
-
setSelection
public void setSelection(int selectionStart, int selectionEnd)Description copied from class:TextFieldSets the selected text.- Overrides:
setSelectionin classTextField
-
moveCursor
protected void moveCursor(boolean forward, boolean jump)- Overrides:
moveCursorin classTextField
-
continueCursor
protected boolean continueCursor(int index, int offset)- Overrides:
continueCursorin classTextField
-
getCursorLine
public int getCursorLine()
-
getFirstLineShowing
public int getFirstLineShowing()
-
getLinesShowing
public int getLinesShowing()
-
getCursorX
public float getCursorX()
-
getCursorY
public float getCursorY()
-
-