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.
Example:
var textArea = new TextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit, "
+ "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim "
+ "ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip "
+ "ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate "
+ "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat "
+ "cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
textArea.setWrapText(true);
TextField
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| public static final int | DEFAULT_PREF_COLUMN_COUNT
The default value for |
| public static final int | DEFAULT_PREF_ROW_COUNT
The default value for |
| private IntegerProperty | prefColumnCount
The preferred number of text columns. |
| private IntegerProperty | prefRowCount
The preferred number of text rows. |
| private DoubleProperty | scrollLeft
The number of pixels by which the content is horizontally scrolled. |
| private DoubleProperty | scrollTop
The number of pixels by which the content is vertically scrolled. |
| private BooleanProperty | wrapText
If a run of text exceeds the width of the |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected Skin | createDefaultSkin()
Overrides javafx. Create a new instance of the default skin for this control. |
| pack-priv String | |
| public static List | Returns: theCssMetaDataHides javafx. Gets the |
| public List | getControlCssMetaData()
Overrides javafx. Gets the unmodifiable list of the control's CSS-styleable properties. |
| public ObservableList | Returns: an unmodifiable list of the character sequences that back the text area's contentReturns an unmodifiable list of the character sequences that back the text area's content. |
| public final int | |
| public final int | |
| public final double | |
| public final double | |
| public final boolean | |
| public final IntegerProperty | |
| public final IntegerProperty | |
| public final DoubleProperty | |
| public final DoubleProperty | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| pack-priv final void | |
| public final BooleanProperty |
| DEFAULT_PARAGRAPH_CAPACITY | back to summary |
|---|---|
| private static final int DEFAULT_PARAGRAPH_CAPACITY | |
| DEFAULT_PREF_COLUMN_COUNT | back to summary |
|---|---|
| public static final int DEFAULT_PREF_COLUMN_COUNT The default value for | |
| DEFAULT_PREF_ROW_COUNT | back to summary |
|---|---|
| public static final int DEFAULT_PREF_ROW_COUNT The default value for | |
| prefColumnCount | back to summary |
|---|---|
| private IntegerProperty prefColumnCount The preferred number of text columns. This is used for
calculating the | |
| prefRowCount | back to summary |
|---|---|
| private IntegerProperty prefRowCount The preferred number of text rows. This is used for calculating
the | |
| scrollLeft | back to summary |
|---|---|
| private DoubleProperty scrollLeft The number of pixels by which the content is horizontally scrolled. | |
| scrollTop | back to summary |
|---|---|
| private DoubleProperty scrollTop The number of pixels by which the content is vertically scrolled. | |
| wrapText | back to summary |
|---|---|
| private BooleanProperty wrapText If a run of text exceeds the width of the | |
| TextArea | back to summary |
|---|---|
| public TextArea() Creates a | |
| TextArea | back to summary |
|---|---|
| public TextArea(String text) Creates a
| |
| createDefaultSkin | back to summary |
|---|---|
| protected Skin Overrides javafx. Doc from javafx. 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
| |
| filterInput | back to summary |
|---|---|
| pack-priv String filterInput(String text) Overrides javafx.
| |
| getClassCssMetaData | back to summary |
|---|---|
| public static List Hides javafx. Gets the
| |
| getControlCssMetaData | back to summary |
|---|---|
| public List Overrides javafx. Doc from javafx. Gets the unmodifiable list of the control's CSS-styleable properties.
| |
| getParagraphs | back to summary |
|---|---|
| public ObservableList Returns an unmodifiable list of the character sequences that back the text area's content.
| |
| getPrefColumnCount | back to summary |
|---|---|
| public final int getPrefColumnCount() | |
| getPrefRowCount | back to summary |
|---|---|
| public final int getPrefRowCount() | |
| getScrollLeft | back to summary |
|---|---|
| public final double getScrollLeft() | |
| getScrollTop | back to summary |
|---|---|
| public final double getScrollTop() | |
| isWrapText | back to summary |
|---|---|
| public final boolean isWrapText() | |
| prefColumnCountProperty | back to summary |
|---|---|
| public final IntegerProperty prefColumnCountProperty() | |
| prefRowCountProperty | back to summary |
|---|---|
| public final IntegerProperty prefRowCountProperty() | |
| scrollLeftProperty | back to summary |
|---|---|
| public final DoubleProperty scrollLeftProperty() | |
| scrollTopProperty | back to summary |
|---|---|
| public final DoubleProperty scrollTopProperty() | |
| setPrefColumnCount | back to summary |
|---|---|
| public final void setPrefColumnCount(int value) | |
| setPrefRowCount | back to summary |
|---|---|
| public final void setPrefRowCount(int value) | |
| setScrollLeft | back to summary |
|---|---|
| public final void setScrollLeft(double value) | |
| setScrollTop | back to summary |
|---|---|
| public final void setScrollTop(double value) | |
| setWrapText | back to summary |
|---|---|
| public final void setWrapText(boolean value) | |
| textUpdated | back to summary |
|---|---|
| pack-priv final void textUpdated() Overrides javafx.
| |
| wrapTextProperty | back to summary |
|---|---|
| public final BooleanProperty wrapTextProperty() | |
| Modifier and Type | Field and Description |
|---|---|
| private TextArea. | |
| private ListListenerHelper |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | addAll(Collection<? extends CharSequence> paragraphs)
Overrides java. Implements java. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). |
| public boolean | addAll(CharSequence... paragraphs)
Implements javafx. A convenience method for var-arg addition of elements. |
| public void | addListener(ListChangeListener<? super CharSequence> listener)
Implements javafx. Add a listener to this observable list. |
| public void | addListener(InvalidationListener listener)
Implements javafx. Adds an |
| public CharSequence | get(int index)
Implements abstract java. Implements java. Returns the element at the specified position in this list. |
| public void | remove(int from, int to)
Implements javafx. A simplified way of calling |
| public boolean | removeAll(CharSequence... elements)
Implements javafx. A convenience method for var-arg usage of the |
| public void | removeListener(ListChangeListener<? super CharSequence> listener)
Implements javafx. Tries to remove a listener from this observable list. |
| public void | removeListener(InvalidationListener listener)
Implements javafx. Removes the given listener from the list of listeners, that are notified
whenever the value of the |
| public boolean | retainAll(CharSequence... elements)
Implements javafx. A convenience method for var-arg usage of the |
| public boolean | setAll(Collection<? extends CharSequence> paragraphs)
Implements javafx. Clears the ObservableList and adds all elements from the collection. |
| public boolean | setAll(CharSequence... paragraphs)
Implements javafx. Clears the ObservableList and adds all the elements passed as var-args. |
| public int | size()
Implements abstract java. Implements java. Returns the number of elements in this list. |
| content | back to summary |
|---|---|
| private TextArea. | |
| listenerHelper | back to summary |
|---|---|
| private ListListenerHelper<CharSequence> listenerHelper | |
| ParagraphList | back to summary |
|---|---|
| private ParagraphList() | |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends CharSequence> paragraphs) Overrides java. Implements java. Doc from java. Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (Note that this will occur if the specified collection is this list, and it's nonempty.)
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(CharSequence... paragraphs) Implements javafx. Doc from javafx. A convenience method for var-arg addition of elements.
| |
| addListener | back to summary |
|---|---|
| public void addListener(ListChangeListener<? super CharSequence> listener) Implements javafx. Doc from javafx. Add a listener to this observable list.
| |
| addListener | back to summary |
|---|---|
| public void addListener(InvalidationListener listener) Implements javafx. Doc from javafx. Adds an
Note that the same actual
The
| |
| get | back to summary |
|---|---|
| public CharSequence get(int index) Implements abstract java. Implements java. Doc from java. Returns the element at the specified position in this list.
| |
| remove | back to summary |
|---|---|
| public void remove(int from, int to) Implements javafx. Doc from javafx. A simplified way of calling
| |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(CharSequence... elements) Implements javafx. Doc from javafx. A convenience method for var-arg usage of the
| |
| removeListener | back to summary |
|---|---|
| public void removeListener(ListChangeListener<? super CharSequence> listener) Implements javafx. Doc from javafx. Tries to remove a listener from this observable list. If the listener is not attached to this list, nothing happens.
| |
| removeListener | back to summary |
|---|---|
| public void removeListener(InvalidationListener listener) Implements javafx. Doc from javafx. Removes the given listener from the list of listeners, that are notified
whenever the value of the If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.
| |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(CharSequence... elements) Implements javafx. Doc from javafx. A convenience method for var-arg usage of the
| |
| setAll | back to summary |
|---|---|
| public boolean setAll(Collection<? extends CharSequence> paragraphs) Implements javafx. Doc from javafx. Clears the ObservableList and adds all elements from the collection.
| |
| setAll | back to summary |
|---|---|
| public boolean setAll(CharSequence... paragraphs) Implements javafx. Doc from javafx. Clears the ObservableList and adds all the elements passed as var-args.
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this list. If this list contains
more than
| |
| Modifier and Type | Field and Description |
|---|---|
| private List |
| Access | Constructor and Description |
|---|---|
| protected | ParagraphListChange(ObservableList<CharSequence> list, int from, int to, List<CharSequence> removed)
|
| Modifier and Type | Method and Description |
|---|---|
| protected int[] | getPermutation()
Overrides com. If this change is a permutation, it returns an integer array that describes the permutation. |
| public List | getRemoved()
Implements abstract javafx. An immutable list of removed/replaced elements. |
| removed | back to summary |
|---|---|
| private List<CharSequence> removed | |
| ParagraphListChange | back to summary |
|---|---|
| protected ParagraphListChange(ObservableList<CharSequence> list, int from, int to, List<CharSequence> removed) | |
| getPermutation | back to summary |
|---|---|
| protected int[] getPermutation() Overrides com. Doc from javafx. If this change is a permutation, it returns an integer array
that describes the permutation.
This array maps directly from the previous indexes to the new ones.
This method is not publicly accessible and therefore can return an array safely.
The 0 index of the array corresponds to index
| |
| getRemoved | back to summary |
|---|---|
| public List Implements abstract javafx. Doc from javafx. An immutable list of removed/replaced elements. If no elements were removed from the list, an empty list is returned.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final CssMetaData | |
| private static final CssMetaData | |
| private static final List | |
| private static final CssMetaData |
| Access | Constructor and Description |
|---|---|
| private |
| PREF_COLUMN_COUNT | back to summary |
|---|---|
| private static final CssMetaData<TextArea, Number> PREF_COLUMN_COUNT | |
| PREF_ROW_COUNT | back to summary |
|---|---|
| private static final CssMetaData<TextArea, Number> PREF_ROW_COUNT | |
| STYLEABLES | back to summary |
|---|---|
| private static final List<CssMetaData<? extends Styleable, ?>> STYLEABLES | |
| WRAP_TEXT | back to summary |
|---|---|
| private static final CssMetaData<TextArea, Boolean> WRAP_TEXT | |
| StyleableProperties | back to summary |
|---|---|
| private StyleableProperties() | |
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private final TextArea. | |
| private final List |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | delete(int start, int end, boolean notifyListeners)
Implements javafx. Removes a sequence of characters from the content. |
| private void | |
| public String | get(int start, int end)
Implements javafx. Retrieves a subset of the content. |
| public String | get()
Implements javafx. Returns the current value of this |
| public String | getValue()
Implements javafx. Returns the current value of this |
| public void | insert(int index, String text, boolean notifyListeners)
Implements javafx. Inserts a sequence of characters into the content. |
| public int | length()
Implements javafx. Returns the number of characters represented by the content. |
| contentLength | back to summary |
|---|---|
| private int contentLength | |
| paragraphList | back to summary |
|---|---|
| private final TextArea. | |
| paragraphs | back to summary |
|---|---|
| private final List<StringBuilder> paragraphs | |
| TextAreaContent | back to summary |
|---|---|
| private TextAreaContent() | |
| delete | back to summary |
|---|---|
| public void delete(int start, int end, boolean notifyListeners) Implements javafx. Doc from javafx. Removes a sequence of characters from the content.
| |
| fireParagraphListChangeEvent | back to summary |
|---|---|
| private void fireParagraphListChangeEvent(int from, int to, List<CharSequence> removed) | |
| get | back to summary |
|---|---|
| public String get(int start, int end) Implements javafx. Doc from javafx. Retrieves a subset of the content.
| |
| get | back to summary |
|---|---|
| public String get() Implements javafx. Doc from javafx. Returns the current value of this
| |
| getValue | back to summary |
|---|---|
| public String getValue() Implements javafx. Doc from javafx. Returns the current value of this
| |
| insert | back to summary |
|---|---|
| public void insert(int index, String text, boolean notifyListeners) Implements javafx. Doc from javafx. Inserts a sequence of characters into the content.
| |
| length | back to summary |
|---|---|
| public int length() Implements javafx. Doc from javafx. Returns the number of characters represented by the content.
| |