Get Started with JavaFX 2 and Scene Builder
By Janice J. Heiss on Nov 21, 2012
Up on otn/java is a very useful article by Oracle Java/Middleware/Core Tech Engineer Mark Heckler, titled, “How to Get Started (FAST!) with JavaFX 2 and Scene Builder.” Heckler, who has development experience in numerous environments, shows developers how to develop a JavaFX application using Scene Builder “in less time than it takes to drink a cup of coffee, while learning your way around in the process”.
He begins with a warning and a reassurance: “JavaFX is a new paradigm and can seem a bit imposing when you first take a look at it. But remember, JavaFX is easy and fun. Let's give it a try.”
Next, after showing readers how to download and install JDK/JavaFX and Scene Builder, he informs the reader that they will “create a simple JavaFX application, create and modify a window using Scene Builder, and successfully test it in under 15 minutes.”
Then readers download some NetBeans files:
“EasyJavaFX.java contains the main application class. We won't do anything with this class for our example, as its primary purpose in life is to load the window definition code contained in the FXML file and then show the main stage/scene. You'll keep the JavaFX terms straight with ease if you relate them to the theater: a platform holds a stage, which contains scenes.
SampleController.java is our controller class that provides the ‘brains’ behind the graphical interface. If you open the SampleController, you'll see that it includes a property and a method tagged with @FXML. This tag enables the integration of the visual controls and elements you define using Scene Builder, which are stored in an FXML (FX Markup Language) file.
Sample.fxml is the definition file for our sample window. You can right-click and Edit the filename in the tree to view the underlying FXML -- and you may need to do that if you change filenames or properties by hand - or you can double-click on it to open it (visually) in Scene Builder.”
Then Scene Builder enters the picture and the task is soon done.
Check out the article here.