February 2017
Beginner
1056 pages
28h 57m
English
Now you see it; now you don’t.
—COMMON MAGICIAN’S SAYING
In this section we show you how to add buttons and icons to a JavaFX application. A button is an object in your application that has a button-like appearance and that does something when you click it with your mouse. An icon is a small picture.
You create a button object in the same way that you create a label object, but you use the class Button instead of the class Label. import the Button class from javafx.scene.control.Button. For example, the application in Listing 6.21 creates a button as follows:
Program Output
If the user clicks either of these buttons, nothing happens.
Button btnSunny ...Read now
Unlock full access