Game Development Reference
In-Depth Information
primaryStage.initStyle(javafx.stage.StageStyle.
TRANSPARENT
);
Figure 4-4
.
Call an .initStyle() method with the StageStyle.TRANSPARENT constant, off the primaryStage Stage ob-
ject
As you can, I clicked the primaryStage Stage object in NetBeans IDE 8.0, in the
code editing area, and it shows (tracks) the
usage
of that object in the code. The Stage
object is set up (displaying title, style, and scene), using the
.setTitle()
,
.initStyle()
,
.setScene()
, and
.show()
method calls.
I am going to leave the .setTitle() method call in the code, but make a mental note
that once you get this windowless application treatment working, the title bar is part of
the window's “chrome,” or UI elements, and when these are gone (including the title
bar), this setting of the title will amount to a moot point.
If you have been worrying about memory optimization, at this point in the applica-
tion development work process, you would remove the .setTitle() method call, because
the title would not be shown using a StageStyle.TRANSPARENT constant for the
StageStyle attribute.
Next, use the
Run icon
(or
Run menu
), and run the application. As
Figure 4-5
il-
lustrates, what you are trying to achieve did not work: the window chrome elements are
gone, and the transparency value is not evident.