Java Reference
In-Depth Information
When the stage is resized, the scene's width and height will also be automati-
cally recalculated and through binding, we quickly see the new geometry and the
recalculated text position, to keep it centered (see Figure 5.5).
Figure 5.5
Stage and Scene Geometry - Stage Resized
In the preceding example, also notice that we set the stage's fill to navy blue, so
the entire background is painted with this color. This is shown as a black back-
ground in Figures 5.4 and 5.5. For a full color view of these figures, please check
out the topic's Web site at http://jfxbook.com. The default color is white. You
can also set the fill to null or transparent by using Color.TRANSPARENT . The
color displayed when setting it to one of these two values is platform dependent.
When we used the StageStype.TRANSPARENT option as shown in Figure 5.3, we
also had to set the scene's fill to null so that the default fill of white would not fill
the rectangular area represented by the scene. Listing 5.4 shows a TRANSPARENT
stage with an invisible background.
Listing 5.4
Transparent Stage
Stage {
title: "TRANSPARENT Stage"
x: 250
y: 150
width: 800
height: 100
style: StageStyle.TRANSPARENT
scene: Scene{
fill: null
content: Text {
fill: Color.YELLOW
textOrigin: TextOrigin.TOP
font: Font { size: 36 }
content:
"JavaFX - Developing Rich Internet Applications"
}
}
}
Search WWH ::




Custom Search