Game Development Reference
In-Depth Information
Figure 6-4 . Declaring and naming the 14 objects that will make up your Scene Graph hierarchy at the top of the
class
You will be taking a look at all these JavaFX classes in detail in this chapter so that
you learn what they are used for and what they can do for your Java applications.
Scene Graph Design: Streamlining the Existing .start()
Method
Now, you can optimize the .start() method so that it only has one or two dozen lines of
code. First, modularize the Scene Graph node creation Java routines into their own cre-
ateSplashScreenNodes() method, which will be called at the top of the .start() method,
as can be seen in Figure 6-5 . After all the nodes are created in this method, create an
addNodesToStackPane() method to add the nodes to the StackPane root node, and
then have the three primaryStage lines of code configuring and managing the Stage ob-
ject and, finally, the ActionEvent handling code routines that “wire” the Button UI con-
trols to the Java code to be executed when they are clicked.
 
 
Search WWH ::




Custom Search