Java Reference
In-Depth Information
readily reused on multiple platforms such as desktop, mobile phone, or a televi-
sion set top box. In a desktop environment, the Stage parallels a window in the
windowing system.
A stage has a title and geometry, may or may not have decorations (the window
border, etc.), and may be resizable. The code in Listing 5.1 creates an empty
stage that is shown in Figure 5.1.
Listing 5.1
Empty Stage
import javafx.stage.Stage;
Stage {
title: "An empty stage"
width: 250
height: 80
}
Let's modify this empty stage to place it at position 150,150, change the title ,
and set resizable to false, so that the stage cannot be resized by the user. Notice
that we set visible to true, which is already the default value, but if we did not
want to display this stage at a specific instant, we could have set this to false.
This is shown in Listing 5.2.
Listing 5.2
Unsizable Stage
Stage {
title: "An empty unsizable stage"
x: 150
y: 150
width: 400
height: 80
resizable: false // default is true
visible: true // default is true
}
Figure 5.1
Empty Stage
 
Search WWH ::




Custom Search