Pro Java 9 Games Development Leveraging the JavaFX APIs

(Michael S) #1
Chapter 11 ■ 3D SCene Configuration: uSing the perSpeCtiveCamera anD pointLight

NetBeans evaluates problems from the most basic (no import statement) on down. Thus, once you have
the import statement in place for the BackgroundFill object, NetBeans continues to evaluate the statement
to see whether there are any other problems with your Java programming constructs, from the inside (the
BackgroundFill) out (to the new Background object, to the .setBackground() method call).
It turns out the constructor method for the BaclgroundFill class requires several parameters, not just
the Color.WHITE color fill specification. This is because the BackgroundFill class will create rounded
corners and supports an Insets object specification as well, so the proper constructor method format for the
BackgroundFill constructor should look like the following:


backgroundFill = new BackgroundFill(Paint, CornerRadii, Insets);


Therefore, for our usage, a complete white color background fill constructor method would use the
EMPTY constant to not have any padding or rounded edges and would therefore look like the following Java
instantiation:


new BackgroundFill( Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY );


Once a BackgroundFill class is imported, NetBeans shows us that the new BackgroundFill(Color.
WHITE) object instantiation has a problem with it, indicated by a wavy red underline underneath the entire
code structure, as shown in Figure 11-11. I placed my mouse over the section of the Java statement I am
constructing, and NetBeans 9 pops up an explanation for the problem, which is shown in the pale yellow box
with a black outline around it.


Figure 11-10. Code your private void createSpecialEffects() method body to create and configure a
DropShadow object

Free download pdf