-
Sub-task
-
Resolution: Fixed
-
P2
-
None
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);
}
}
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);
}
}
- relates to
-
JDK-8100310 Remove the obsolete start() method and make start(Stage) abstract
-
- Resolved
-