Game Development Reference
In-Depth Information
Figure 17-4
.
Add the scoreText Text Node object to the JavaFX Scene Graph, using a .getChildren().add() method
chain
The next step, now that we can see the Text object in the Scene, is to instantiate the
scoreFont Font object using the Java new keyword and a Font(String fontName, int
fontSize) constructor method call. The Java statement to accomplish this is shown
highlighted in
Figure 17-5
,
and should look like the following:
scoreFont =
new
Font(
"Verdana", 20
);
Figure 17-5
.
Instantiate scoreFont object with a Java new keyword and Font(String fontName, int fontSize) con-
structor