Control elements
The control elements are included in the javafx.scene.control
package (https://openjfx.io/javadoc/11/javafx.controls/javafx/scene/control/package-summary.html). There are more than 80 of them, including a button, text field, checkbox, label, menu, progress bar, and scroll bar, to name a few. As we have mentioned already, each control element is a subclass of Node
that has more than 200 methods. So, you can imagine how rich and fine-tuned a GUI can be when built using JavaFX. However, the scope of this book allows us to cover only a few elements and their methods.
We have already implemented a button in the example in the preceding section. Let’s now use a label and a text field to create a simple form with input fields (first name, last name, and age) and a Submit button. We will build it in steps. All the following code snippets are sequential sections of another start()
method in the HelloWorld
class (rename the previous start()
method start1()
, and rename...