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


The last test is to make sure that our JavaFX application is transparent on top of the OS desktop itself.
Drag the NetBeans 9 IDE out of the way, and see your Button UI element on top of the desktop background
image, which you can see in Figure 7-12 is now working perfectly.


You can also see the code collapse and expand icons (plus and minus icons at the left of the code) at
work. I have closed (collapsed) the .start() method and opened the .main() method. Clicking the minus will
close the .main() method, and clicking the plus icons will open the import statements and .start() method
code bodies.
I closed the import statements block and .start() method code block to show you the five primary
areas for this class: your javafxgame package declaration, your import statements block, your JavaFXGame
Application subclass declaration, and the two primary methods needed for any JavaFX 9 games (or IoT)
application, which are .start() and .main().
Using 2D, 3D, and alpha channels, some crazy cool apps can be created using this StageStyle.
TRANSPARENT capability, so I thought I would show this to you early on during the book so that I could get
some cool tricks and tips pertaining to enhancing your JavaFX IoT application and pro Java games coding
experience into this JavaFX “overview” chapter. Defining a game or i3D virtual object that floats right on an
OS desktop is a rare and visually impactive result.
Now that we’ve taken a fun coding break from reviewing all of the JavaFX 9 APIs that most directly relate
to pro Java 9 games development, let’s get back into looking at some of the other JavaFX modules, packages,
and class offerings that you may want to know about regarding interactivity, UI design, charting, audio, or
video media assets, as well as about interfacing with the Internet and social media platforms. We’ll also
briefly cover some of the APIs you won’t use!
Now that we have taken a look at the javafx.stage package, let’s look at the javafx.geometry package next.


Figure 7-12. The JavaFX application seamlessly composited on top of the Windows 7 OS desktop's wallpaper

Free download pdf