Package arc.scene.ui

Class TextArea

All Implemented Interfaces:
Disableable

public class TextArea extends TextField
A multiple-line text input field, entirely based on TextField
  • Field Details

    • linesBreak

      protected IntSeq linesBreak
      Array storing starting and ending positions of each line.
    • cursorLine

      protected int cursorLine
      Current line for the cursor
    • firstLineShowing

      protected int firstLineShowing
      Index of the first line showed by the text area
    • moveOffset

      protected float moveOffset
      Variable to maintain the x offset of the cursor when moving up and down. If it's set to -1, the offset is reset
    • lastText

      protected String lastText
      Last text processed. This attribute is used to avoid unnecessary computations while calculating offsets
    • linesShowing

      protected int linesShowing
      Number of lines showed by the text area
    • prefRows

      protected float prefRows
  • Constructor Details

  • Method Details

    • initialize

      protected void initialize()
      Overrides:
      initialize in class TextField
    • letterUnderCursor

      protected int letterUnderCursor(float x)
      Overrides:
      letterUnderCursor in class TextField
    • 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 class TextField
    • 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 class Element
    • getTextY

      protected float getTextY(Font font, Drawable background)
      Overrides:
      getTextY in class TextField
    • drawSelection

      protected void drawSelection(Drawable selection, Font font, float x, float y)
      Description copied from class: TextField
      Draws selection rectangle
      Overrides:
      drawSelection in class TextField
    • drawText

      protected void drawText(Font font, float x, float y)
      Overrides:
      drawText in class TextField
    • drawCursor

      protected void drawCursor(Drawable cursorPatch, Font font, float x, float y)
      Overrides:
      drawCursor in class TextField
    • calculateOffsets

      protected void calculateOffsets()
      Overrides:
      calculateOffsets in class TextField
    • createInputListener

      protected InputListener createInputListener()
      Overrides:
      createInputListener in class TextField
    • setSelection

      public void setSelection(int selectionStart, int selectionEnd)
      Description copied from class: TextField
      Sets the selected text.
      Overrides:
      setSelection in class TextField
    • moveCursor

      protected void moveCursor(boolean forward, boolean jump)
      Overrides:
      moveCursor in class TextField
    • continueCursor

      protected boolean continueCursor(int index, int offset)
      Overrides:
      continueCursor in class TextField
    • getCursorLine

      public int getCursorLine()
    • getFirstLineShowing

      public int getFirstLineShowing()
    • getLinesShowing

      public int getLinesShowing()
    • getCursorX

      public float getCursorX()
    • getCursorY

      public float getCursorY()