public class TextField extends TextInputControl
TextArea
control. Additionally, if you want
a form of rich-text editing, there is also the
HTMLEditor
control.
TextField supports the notion of showing prompt text
to the user when there is no text
already in the
TextField (either via the user, or set programmatically). This is a useful
way of informing the user as to what is expected in the text field, without
having to resort to tooltips
or on-screen labels
.
TextArea
Type | Property and Description |
---|---|
<any> |
alignment
Specifies how the text should be aligned when there is empty
space within the TextField.
|
<any> |
onAction
The action handler associated with this text field, or
null if no action handler is assigned. |
IntegerProperty |
prefColumnCount
The preferred number of text columns.
|
anchorProperty, caretPositionProperty, editableProperty, fontProperty, lengthProperty, promptTextProperty, redoableProperty, selectedTextProperty, selectionProperty, textFormatterProperty, textProperty, undoableProperty
contextMenuProperty, skinClassNameProperty, skinProperty, tooltipProperty
Modifier and Type | Class and Description |
---|---|
private static class |
TextField.StyleableProperties
*
Stylesheet Handling *
*
|
private static class |
TextField.TextFieldContent |
TextInputControl.Content, TextInputControl.UndoRedoChange
Modifier and Type | Field and Description |
---|---|
private <any> |
alignment |
static int |
DEFAULT_PREF_COLUMN_COUNT
The default value for
prefColumnCount . |
private <any> |
onAction
The action handler associated with this text field, or
null if no action handler is assigned. |
private IntegerProperty |
prefColumnCount
The preferred number of text columns.
|
Constructor and Description |
---|
TextField()
Creates a
TextField with empty text content. |
TextField(java.lang.String text)
Creates a
TextField with initial text content. |
Modifier and Type | Method and Description |
---|---|
<any> |
alignmentProperty()
Specifies how the text should be aligned when there is empty
space within the TextField.
|
protected Skin<?> |
createDefaultSkin()
Create a new instance of the default skin for this control.
|
Pos |
getAlignment()
Gets the value of the property alignment.
|
java.lang.CharSequence |
getCharacters()
Returns the character sequence backing the text field's content.
|
static java.util.List<<any>> |
getClassCssMetaData() |
java.util.List<<any>> |
getControlCssMetaData() |
<any> |
getOnAction()
Gets the value of the property onAction.
|
int |
getPrefColumnCount()
Gets the value of the property prefColumnCount.
|
<any> |
onActionProperty()
The action handler associated with this text field, or
null if no action handler is assigned. |
IntegerProperty |
prefColumnCountProperty()
The preferred number of text columns.
|
void |
setAlignment(Pos value)
Sets the value of the property alignment.
|
void |
setOnAction(<any> value)
Sets the value of the property onAction.
|
void |
setPrefColumnCount(int value)
Sets the value of the property prefColumnCount.
|
anchorProperty, appendText, backward, cancelEdit, caretPositionProperty, clear, commitValue, containsInvalidCharacters, copy, cut, deleteNextChar, deletePreviousChar, deleteText, deleteText, deselect, editableProperty, end, endOfNextWord, executeAccessibleAction, extendSelection, filterInput, fontProperty, forward, getAnchor, getCaretPosition, getContent, getFont, getLength, getPromptText, getSelectedText, getSelection, getText, getText, getTextFormatter, home, insertText, isEditable, isRedoable, isUndoable, lengthProperty, nextWord, paste, positionCaret, previousWord, promptTextProperty, queryAccessibleAttribute, redo, redoableProperty, replaceSelection, replaceText, replaceText, selectAll, selectBackward, selectedTextProperty, selectEnd, selectEndOfNextWord, selectForward, selectHome, selectionProperty, selectNextWord, selectPositionCaret, selectPreviousWord, selectRange, setEditable, setFont, setPromptText, setText, setTextFormatter, textFormatterProperty, textProperty, textUpdated, undo, undoableProperty
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, getBaselineOffset, getContextMenu, getControlChildren, getCssMetaData, getInitialFocusTraversable, getSkin, getTooltip, isResizable, layoutChildren, loadSkinClass, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipProperty
public final IntegerProperty prefColumnCountProperty
TextField
's preferred width.getPrefColumnCount()
,
setPrefColumnCount(int)
public final <any> onActionProperty
null
if no action handler is assigned.
The action handler is normally called when the user types the ENTER key.getOnAction()
,
#setOnAction()
public final <any> alignmentProperty
getAlignment()
,
setAlignment(Pos)
public static final int DEFAULT_PREF_COLUMN_COUNT
prefColumnCount
.private IntegerProperty prefColumnCount
TextField
's preferred width.private <any> onAction
null
if no action handler is assigned.
The action handler is normally called when the user types the ENTER key.private <any> alignment
public TextField()
TextField
with empty text content.public TextField(java.lang.String text)
TextField
with initial text content.text
- A string for text content.public java.lang.CharSequence getCharacters()
public final IntegerProperty prefColumnCountProperty()
TextField
's preferred width.getPrefColumnCount()
,
setPrefColumnCount(int)
public final int getPrefColumnCount()
public final void setPrefColumnCount(int value)
public final <any> onActionProperty()
null
if no action handler is assigned.
The action handler is normally called when the user types the ENTER key.getOnAction()
,
#setOnAction()
public final <any> getOnAction()
public final void setOnAction(<any> value)
public final <any> alignmentProperty()
getAlignment()
,
setAlignment(Pos)
public final void setAlignment(Pos value)
public final Pos getAlignment()
protected Skin<?> createDefaultSkin()
-fx-skin
or set explicitly in a sub-class with setSkin(...)
.createDefaultSkin
in class Control
public static java.util.List<<any>> getClassCssMetaData()
public java.util.List<<any>> getControlCssMetaData()
getControlCssMetaData
in class TextInputControl