Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 9 ■ JavaFX 9 User InterFaCe DesIgn: the Front enD For Java 9 game DesIgn

With the .addAll() method, this changes to become left to right, so the objects added first (left) are
on the bottom of the compositing layer stack. A new addNodesToStackPane() method structure using
.getChildren().addAll() method calls would therefore look like the following, as shown highlighted at the
bottom of Figure 9-19:


private void addNodesToSCeneGraph() {
root.getChildren().addAll(gameBoard, uiLayout);
uiLayout.getChildren().addAll(boardGameBackPlate, logoLayer, infoOverlay, uiContainer);
uiContainer.getChildren().addAll(gameButton, helpButton, legalButton,
creditButton, scoreButton);
infoOverlay.getChildren().addAll(playText, moreText);
}


Figure 9-19. Consolidate six .add() method calls into two .addAll() method calls off of a SceneGraph root and
UI branch

Free download pdf