Class TextField

java.lang.Object
All Implemented Interfaces:
Styleable, EventTarget, Skinnable
Direct Known Subclasses:
PasswordField

public class TextField extends TextInputControl
Text input component that allows a user to enter a single line of unformatted text. Unlike in previous releases of JavaFX, support for multi-line input is not available as part of the TextField control, however this is the sole-purpose of the 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.

Example:

 var textField = new TextField("Hello World!");
Image of the TextField control
Since:
JavaFX 2.0
See Also: