Game Development Reference
In-Depth Information
Next, let's add the Node objects to the StackPane Scene Graph root object in an ad-
dNodesToStackPane() method.
Adding Nodes to the Scene Graph: .addStack-
PaneNodes()
Finally, you have to create a method that will add the Node objects that you have cre-
ated to the Scene Graph root, which, in this case, is a StackPane object. You will use
the .getChildren().add() method chain to add the children Node objects to the parent
StackPane root Scene Graph node. This is done via three simple lines of Java code, like
this:
root.getChildren().add(splashScreenBackplate);
root.getChildren().add(splashScreenTextArea);
root.getChildren().add(buttonContainer);
As you can see in Figure 6-8 , the Java code is error free, and the root object sees its
declaration at the top of the class. Clicking the root object in the code creates this high-
lighting, which traces the use of the object through the code. This is a pretty cool
NetBeans 8.0 trick that you should use whenever you want to track an object in code.
 
 
Search WWH ::




Custom Search