Class TextArea

All Implemented Interfaces:
Styleable, EventTarget, Skinnable

public class TextArea extends TextInputControl
Text input component that allows a user to enter multiple lines of plain text. Unlike in previous releases of JavaFX, support for single line input is not available as part of the TextArea control, however this is the sole-purpose of the TextField control. Additionally, if you want a form of rich-text editing, there is also the HTMLEditor control.

TextArea supports the notion of showing prompt text to the user when there is no text already in the TextArea (either via the user, or set programmatically). This is a useful way of informing the user as to what is expected in the text area, without having to resort to tooltips or on-screen labels.

Since:
JavaFX 2.0
See Also:
  • Property Details

  • Field Details

  • Constructor Details

    • TextArea

      public TextArea()
      Creates a TextArea with empty text content.
    • TextArea

      public TextArea(String text)
      Creates a TextArea with initial text content.
      Parameters:
      text - A string for text content.
  • Method Details

    • getParagraphs

      public ObservableList<CharSequence> getParagraphs()
      Returns an unmodifiable list of the character sequences that back the text area's content.
      Returns:
      an unmodifiable list of the character sequences that back the text area's content
    • wrapTextProperty

      public final BooleanProperty wrapTextProperty()
      If a run of text exceeds the width of the TextArea, then this variable indicates whether the text should wrap onto another line.
      Returns:
      the wrapText property
      See Also:
    • isWrapText

      public final boolean isWrapText()
      Gets the value of the wrapText property.
      Property description:
      If a run of text exceeds the width of the TextArea, then this variable indicates whether the text should wrap onto another line.
      Returns:
      the value of the wrapText property
      See Also:
    • setWrapText

      public final void setWrapText(boolean value)
      Sets the value of the wrapText property.
      Property description:
      If a run of text exceeds the width of the TextArea, then this variable indicates whether the text should wrap onto another line.
      Parameters:
      value - the value for the wrapText property
      See Also:
    • prefColumnCountProperty

      public final IntegerProperty prefColumnCountProperty()
      The preferred number of text columns. This is used for calculating the TextArea's preferred width.
      Returns:
      the prefColumnCount property
      See Also:
    • getPrefColumnCount

      public final int getPrefColumnCount()
      Gets the value of the prefColumnCount property.
      Property description:
      The preferred number of text columns. This is used for calculating the TextArea's preferred width.
      Returns:
      the value of the prefColumnCount property
      See Also:
    • setPrefColumnCount

      public final void setPrefColumnCount(int value)
      Sets the value of the prefColumnCount property.
      Property description:
      The preferred number of text columns. This is used for calculating the TextArea's preferred width.
      Parameters:
      value - the value for the prefColumnCount property
      See Also:
    • prefRowCountProperty

      public final IntegerProperty prefRowCountProperty()
      The preferred number of text rows. This is used for calculating the TextArea's preferred height.
      Returns:
      the prefRowCount property
      See Also:
    • getPrefRowCount

      public final int getPrefRowCount()
      Gets the value of the prefRowCount property.
      Property description:
      The preferred number of text rows. This is used for calculating the TextArea's preferred height.
      Returns:
      the value of the prefRowCount property
      See Also:
    • setPrefRowCount

      public final void setPrefRowCount(int value)
      Sets the value of the prefRowCount property.
      Property description:
      The preferred number of text rows. This is used for calculating the TextArea's preferred height.
      Parameters:
      value - the value for the prefRowCount property
      See Also:
    • scrollTopProperty

      public final DoubleProperty scrollTopProperty()
      The number of pixels by which the content is vertically scrolled.
      Returns:
      the scrollTop property
      See Also:
    • getScrollTop

      public final double getScrollTop()
      Gets the value of the scrollTop property.
      Property description:
      The number of pixels by which the content is vertically scrolled.
      Returns:
      the value of the scrollTop property
      See Also:
    • setScrollTop

      public final void setScrollTop(double value)
      Sets the value of the scrollTop property.
      Property description:
      The number of pixels by which the content is vertically scrolled.
      Parameters:
      value - the value for the scrollTop property
      See Also:
    • scrollLeftProperty

      public final DoubleProperty scrollLeftProperty()
      The number of pixels by which the content is horizontally scrolled.
      Returns:
      the scrollLeft property
      See Also:
    • getScrollLeft

      public final double getScrollLeft()
      Gets the value of the scrollLeft property.
      Property description:
      The number of pixels by which the content is horizontally scrolled.
      Returns:
      the value of the scrollLeft property
      See Also:
    • setScrollLeft

      public final void setScrollLeft(double value)
      Sets the value of the scrollLeft property.
      Property description:
      The number of pixels by which the content is horizontally scrolled.
      Parameters:
      value - the value for the scrollLeft property
      See Also:
    • createDefaultSkin

      protected Skin<?> createDefaultSkin()
      Create a new instance of the default skin for this control. This is called to create a skin for the control if no skin is provided via CSS -fx-skin or set explicitly in a sub-class with setSkin(...).
      Overrides:
      createDefaultSkin in class Control
      Returns:
      new instance of default skin for this control. If null then the control will have no skin unless one is provided by css.
    • getClassCssMetaData

      public static List<CssMetaData<? extends Styleable,?>> getClassCssMetaData()
      Returns:
      The CssMetaData associated with this class, which may include the CssMetaData of its superclasses.
      Since:
      JavaFX 8.0
    • getControlCssMetaData

      public List<CssMetaData<? extends Styleable,?>> getControlCssMetaData()
      Overrides:
      getControlCssMetaData in class TextInputControl
      Returns:
      unmodifiable list of the controls css styleable properties
      Since:
      JavaFX 8.0