Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 12 ■ 3D MoDel Design anD priMitives: Using JavaFX 9 shape3D Classes


class (second in the pop-up helper drop-down list) that is used for 2D UI design and at the top of the list
is (NetBeans best guess) the javafx.scene.shape.Box that is for use as a 3D primitive! Double-click the first
(correct) class and have NetBeans write the import statement for you.


Instantiate the box object in the createBoardGameNodes() method using the second constructor,
as shown in Figure 12-2. Remember, you need to add this box Node to the SceneGraph in the
.addNodesToSceneGraph() method.


Figure 12-1. Declare a Box object at the top of the class; use Alt+Enter, and select Add import for javafx.scene.
shape.Box


Figure 12-2. Instantiate the Box in createBoardGameNodes, and set the depth, height, and width to 100, 100, 100

Free download pdf