The first chapter of the book introduced you to the fundamentals of the JavaFX language. Now, you are ready to start building your own JavaFX desktop application. In this recipe, we will look at the minimal requirements to build a runnable / JavaFX application.
In order to write your application, you will need to use an IDE or your favorite text editor. Refer to Chapter 1, Getting Started with JavaFX, to find out how to download and get started with JavaFX with the NetBeans or Eclipse IDE.
The listing below shows how to create a simple, yet functional JavaFX application that uses several components of the JavaFX application framework. The full listing of the code is available at ch02/source-code/src/application/SimpleApplication.fx
.
import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.shape.Rectangle; import javafx.scene.text.Text; Stage { title...