Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8099513 Application life-cyle model and implementation
  3. JDK-8100309

Application start method should take the primary Stage as an argument

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P2 P2
    • fx2.0
    • None
    • javafx

      In order to more easily support applets and applications, and to clearly delineate when the primary stage is created, the abstract Application class will change such that the no-argument start() method will be replaced with start(Stage primaryStage). The application framework will create the primary stage before calling the start(Stage), and will pass that stage into the start method. The primary Stage will be the one that is embedded in a browser in the case where we are running in applet mode. Other stages can still be created but they will not be primary stages and will not be embedded in the browser.

      As part of this change, the Stage.style property will become mutable. After the stage is initially set visible, the style must not be set, and any attempt to do so will result in an IllegalStateException.

      Old pattern:

          class MyApp extends Application {
              @Override public void start() {
                  Stage stage = new Stage();
                  ...
                  stage.setScene(scene);
                  stage.setVisible(true);
              }
          }


      New pattern:

          class MyApp extends Application {
              @Override public void start(Stage stage) {
                  ...
                  stage.setScene(scene);
                  stage.setVisible(true);
              }
          }

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: