javafx – Windows – Creating a new Window

To show some content in a new window, a Stage needs to be created. After creation and initialisation show or showAndWait needs to be called on the Stage object:

// create sample content
Rectangle rect = new Rectangle(100, 100, 200, 300);
Pane root = new Pane(rect);
root.setPrefSize(500, 500);

Parent content = root;

// create scene containing the content
Scene scene = new Scene(content);

Stage window = new Stage();
window.setScene(scene);

// make window visible
window.show();

Note: This code needs to be executed on the JavaFX application thread.

if you want to reproduce, please indicate the source:
javafx – Windows – Creating a new Window - CodeDay