public class MultipleStageDemo extends Application
1:
2: import javafx.application.Application;
3: import javafx.scene.Scene;
4: import javafx.scene.control.Button;
5: import javafx.stage.Stage;
6:
7: public class MultipleStageDemo extends Application {
8: @Override // Override the start method in the Application class
9: public void start(Stage primaryStage) {
10: // Create a scene and place a button in the scene
11: Scene scene = new Scene(new Button("OK"), 200, 250);
12: primaryStage.setTitle("MyJavaFX"); // Set the stage title
13: primaryStage.setScene(scene); // Place the scene in the stage
14: primaryStage.show(); // Display the stage
15:
16: Stage stage = new Stage(); // Create a new stage
17: stage.setTitle("Second Stage"); // Set the stage title
18: // Set a scene with a button in the stage
19: stage.setScene(new Scene(new Button("New Stage"), 100, 100));
20: stage.show(); // Display the stage
21: }
22:
23: /**
24: * The main method is only needed for the IDE with limited
25: * JavaFX support. Not needed for running from the command line.
26: */
27: //public static void main(String[] args) {
28: // launch(args);
29: // }
30: }