Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 10 ■ User InterfaCe DesIgn InteraCtIvIty: event hanDlIng anD ImagIng effeCts


Notice in Figure 10-3 that I left both the gameButton and helpButton event handling structures open in
the NetBeans 9 IDE using the plus (+) icons in the left margin of the code editing pane so that you can see
from a Java code perspective how these Java 9 code blocks inside of your .handle() methods set all of your
compositing pipeline object characteristics to control each different Button object’s screen designs using
only a handful of different variable and object settings. This is an example of how powerful Java can be when
you set up your JavaFX Scene Graph optimally.
Use your Run ➤ Project work process, and again toggle between the Start Game and Game Rules
Button UI controls. You’ll see that the Game Rules button no longer messes up your Start Game screen, as
shown in Figure 10-4.


Figure 10-3. Implement the code in the handle() method to configure gameButton default UI compositing
layer objects

Free download pdf