Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1

Chapter 7 ■ IntroduCtIon to JavaFX 9: overvIew oF the JavaFX new MedIa engIne


Run the application again to see whether the transparency is showing yet. As you can see in Figure 7-9,
it is still not transparent. Since we are using a StackPane object to implement layers in the BoardGame
application, this is the next level up that we need to try to set a transparency value at. JavaFX uses a Color
class constant to determine a default background color value for all its UI objects. If I were on the JavaFX 9
team, I’d be arguing for this to be changed to the Color.TRANSPARENT constant, but of course, this might
confuse new users, as alpha channel and compositing layers are advanced concepts and topics, which is
why they are at the beginning of this pro Java 9 games development book in Chapter 2 covering digital image
compositing and related concepts. Notice in Figure 7-9 that NetBeans has imported the Java Color class for
you since you used it in the scene.setFill(Color.TRANSPARENT); Java statement.


Figure 7-8. Type the Color class name and period in the parameter area, and find and select a
TRANSPARENT constant

Free download pdf