1public void start(Stage stage) throws Exception {
2 FXMLLoader ldr = new FXMLLoader(getClass()
3 .getResource("Application.fxml"));
4 Parent root = (Parent) ldr.load();
5 appCtrl = (ApplicationController) ldr.getController();
6
7 Scene scene = new Scene(root);
8
9 stage.setScene(scene);
10 stage.show();
11
12 scene.getWindow().setOnCloseRequest(new EventHandler<WindowEvent>() {
13 public void handle(WindowEvent ev) {
14 if (!appCtrl.shutdown()) {
15 ev.consume();
16 }
17 }
18 });
19}
20