Package arc.scene.ui
Class TextArea
java.lang.Object
arc.scene.Element
arc.scene.ui.TextField
arc.scene.ui.TextArea
- All Implemented Interfaces:
Disableable
A multiple-line text input field, entirely based on
TextField
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
Input listener for the text areaNested classes/interfaces inherited from class arc.scene.ui.TextField
TextField.TextFieldClickListener, TextField.TextFieldFilter, TextField.TextFieldListener, TextField.TextFieldStyle, TextField.TextFieldValidator
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Current line for the cursorprotected int
Index of the first line showed by the text areaprotected String
Last text processed.protected IntSeq
Array storing starting and ending positions of each line.protected int
Number of lines showed by the text areaprotected float
Variable to maintain the x offset of the cursor when moving up and down.protected float
Fields inherited from class arc.scene.ui.TextField
BACKSPACE, blinkTime, BULLET, cursor, cursorOn, DELETE, disabled, displayText, filter, focusTraversal, fontOffset, glyphPositions, hasInputDialog, hasSelection, imeData, inputDialogListener, inputListener, keyRepeatInitialTime, keyRepeatTask, keyRepeatTime, lastBlink, lastChangeTime, layout, listener, maxLength, messageText, onlyFontChars, passwordBuffer, passwordCharacter, passwordMode, programmaticChangeEvents, renderOffset, selectionStart, selectionWidth, selectionX, style, TAB, text, textHAlign, textHeight, textOffset, undoText, validator, visibleTextEnd, visibleTextStart, writeEnters
Fields inherited from class arc.scene.Element
color, cullable, fillParent, height, name, originX, originY, parent, parentAlpha, rotation, scaleX, scaleY, touchable, touchablility, translation, userObject, visibility, visible, width, x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected boolean
continueCursor
(int index, int offset) protected InputListener
protected void
drawCursor
(Drawable cursorPatch, Font font, float x, float y) protected void
drawSelection
(Drawable selection, Font font, float x, float y) Draws selection rectangleprotected void
int
float
float
int
int
getLines()
Returns total number of lines that the text occupiesint
float
protected float
protected void
protected int
letterUnderCursor
(float x) protected void
moveCursor
(boolean forward, boolean jump) void
moveCursorLine
(int line) Moves the cursor to the given number lineboolean
Returns if there's a new line at then end of the textvoid
setPrefRows
(float prefRows) Sets the preferred number of rows (lines) for this text area.void
setSelection
(int selectionStart, int selectionEnd) Sets the selected text.protected void
Called when the actor's size has been changed.Methods inherited from class arc.scene.ui.TextField
addInputDialog, appendText, clearSelection, clearText, copy, cut, draw, getCursorPosition, getDefaultInputListener, getFilter, getMaxLength, getMessageText, getPrefWidth, getProgrammaticChangeEvents, getSelection, getSelectionStart, getStyle, getText, getValidator, isDisabled, isPasswordMode, isValid, isWordCharacter, next, paste, removeInputDialog, selectAll, setAlignment, setBlinkTime, setCursorPosition, setDisabled, setFilter, setFocusTraversal, setMaxLength, setMessageText, setOnlyFontChars, setPasswordCharacter, setPasswordMode, setProgrammaticChangeEvents, setStyle, setText, setTextFieldListener, setValidator, typed, typed, updateDisplayText, wordUnderCursor
Methods inherited from class arc.scene.Element
act, actions, addAction, addCaptureListener, addListener, change, changed, clear, clearActions, clearListeners, clicked, clicked, clicked, clicked, clipBegin, clipBegin, clipEnd, dragged, exited, fire, fireClick, getActions, getCaptureListeners, getHeight, getListeners, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getRight, getRotation, getScene, getTop, getWidth, getX, getY, getZIndex, hasActions, hasKeyboard, hasMouse, hasParent, hasScroll, hit, hovered, invalidate, invalidateHierarchy, isAscendantOf, isDescendantOf, isDescendantOf, isTouchable, keepInStage, keyDown, keyDown, layout, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, needsLayout, notify, pack, parentToLocalCoordinates, released, remove, removeAction, removeCaptureListener, removeListener, requestKeyboard, requestScroll, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, scrolled, setBounds, setColor, setColor, setFillParent, setHeight, setLayoutEnabled, setOrigin, setOrigin, setPosition, setPosition, setRotation, setRotationOrigin, setScale, setScale, setScene, setSize, setSize, setTranslation, setWidth, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, tapped, toBack, toFront, toString, touchable, update, updateVisibility, validate, visible
-
Field Details
-
linesBreak
Array storing starting and ending positions of each line. -
cursorLine
protected int cursorLineCurrent line for the cursor -
firstLineShowing
protected int firstLineShowingIndex of the first line showed by the text area -
moveOffset
protected float moveOffsetVariable to maintain the x offset of the cursor when moving up and down. If it's set to -1, the offset is reset -
lastText
Last text processed. This attribute is used to avoid unnecessary computations while calculating offsets -
linesShowing
protected int linesShowingNumber of lines showed by the text area -
prefRows
protected float prefRows
-
-
Constructor Details
-
TextArea
-
TextArea
-
-
Method Details
-
initialize
protected void initialize()- Overrides:
initialize
in classTextField
-
letterUnderCursor
protected int letterUnderCursor(float x) - Overrides:
letterUnderCursor
in classTextField
-
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()- Overrides:
getPrefHeight
in 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:Element
Called when the actor's size has been changed.- Overrides:
sizeChanged
in classElement
-
getTextY
-
drawSelection
Description copied from class:TextField
Draws selection rectangle- Overrides:
drawSelection
in classTextField
-
drawText
-
drawCursor
- Overrides:
drawCursor
in classTextField
-
calculateOffsets
protected void calculateOffsets()- Overrides:
calculateOffsets
in classTextField
-
createInputListener
- Overrides:
createInputListener
in classTextField
-
setSelection
public void setSelection(int selectionStart, int selectionEnd) Description copied from class:TextField
Sets the selected text.- Overrides:
setSelection
in classTextField
-
moveCursor
protected void moveCursor(boolean forward, boolean jump) - Overrides:
moveCursor
in classTextField
-
continueCursor
protected boolean continueCursor(int index, int offset) - Overrides:
continueCursor
in classTextField
-
getCursorLine
public int getCursorLine() -
getFirstLineShowing
public int getFirstLineShowing() -
getLinesShowing
public int getLinesShowing() -
getCursorX
public float getCursorX() -
getCursorY
public float getCursorY()
-