Home » JavaFX TextField

JavaFX TextField

by Online Tutorials Library

JavaFX TextField

Text Field is basically used to get the input from the user in the form of text. javafx.scene.control.TextField represents TextField. It provides various methods to deal with textfields in JavaFX. TextField can be created by instantiating TextField class.

Lets see an example where the user is shown the two text boxes and prompted to fill its user-id and password.

Output:

JavaFX TextField

Getting Text field Data

TextField class provides an instance method getText() to retrieve the textfield data. It returns String object which can be used to save the user details in database.

Output:

JavaFX TextField 1

You may also like