Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 7 ■ IntroduCtIon to JavaFX 9: overvIew oF the JavaFX new MedIa engIne

You’re now ready to again test your windowless (transparent) JavaFX application version by using your
Run Project work process, either via the Run menu or via the green play transport icon at the top left of the
NetBeans IDE.
As you can see in Figure 7-11, we’ve now achieved our objective, and just the Button object is visible on
top of the NetBeans IDE Java code editing pane, which is the next application under the running Java code
window. Under that is the OS desktop.
You can also see that NetBeans added your Background class import statement and the nine lines of
the StackPane (root) and Scene (scene) objects Java 9 code, which we added to make this end result happen
in lines 25 to 33 of Figure 7-11. Be sure to understand the progression of the creation of these objects and
how they link, or “wire up,” as I like to call it, into each other, becoming inexorably functionally intertwined.
Understand that the order of the Java 9 programming statements is nearly as important as the construction
of the Java 9 statements themselves.
For instance, you can’t code line 28 until you have coded line 25, where you instantiate your root
StackPane object, so that you can use it to create the scene’s Scene object.
I clicked the root object in NetBeans 9 to tell the IDE to show me the usage of that object in the class,
which, as you’ll see in Figure 7-11, is tracked using yellow highlighting on the root object in the Java 9 code.
This cool feature becomes more and more important the more complex and complicated your pro Java 9
games code becomes. As I mentioned in Chapter 6 , we will be covering handy NetBeans 9 features during
many of the chapters in this book.


Figure 7-11. The transparency now goes through all objects (layers), and the button is now rendered on the
OS directly

Free download pdf