public class Stage
  Comment     Returned-by     Constructor-argument     Method-argument     Field-type     Type-bound     Links  

The JavaFX Stage class is the top level JavaFX container. The primary Stage is constructed by the platform. Additional Stage objects may be constructed by the application.

Stage objects must be constructed and modified on the JavaFX Application Thread.

Many of the Stage properties are read only because they can be changed externally by the underlying platform and therefore must not be bindable.

Style

A stage has one of the following styles:

The style must be initialized before the stage is made visible.

On some platforms decorations might not be available. For example, on some mobile or embedded devices. In these cases a request for a DECORATED or UTILITY window will be accepted, but no decorations will be shown.

Owner

A stage can optionally have an owner Window. When a window is a stage's owner, it is said to be the parent of that stage.

Owned Stages are tied to the parent Window. An owned stage will always be on top of its parent window. When a parent window is closed or iconified, then all owned windows will be affected as well. Owned Stages cannot be independantly iconified.

The owner must be initialized before the stage is made visible.

Modality

A stage has one of the following modalities:

When a window is blocked by a modal stage its Z-order relative to its ancestors is preserved, and it receives no input events and no window activation events, but continues to animate and render normally. Note that showing a modal stage does not necessarily block the caller. The show method returns immediately regardless of the modality of the stage. Use the showAndWait method if you need to block the caller until the modal stage is hidden (closed). The modality must be initialized before the stage is made visible.

Example:


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

public class HelloWorld extends Application {

    @Override public void start(Stage stage) {
        Text text = new Text(10, 40, "Hello World!");
        text.setFont(new Font(40));
        Scene scene = new Scene(new Group(text));

        stage.setTitle("Welcome to JavaFX!");
        stage.setScene(scene);
        stage.sizeToScene();
        stage.show();
    }

    public static void main(String[] args) {
        Application.launch(args);
    }
}

 

produces the following on Windows:

produces the following on Mac OSX:

produces the following on Linux:

extends Window

Since:  JavaFX 2.0