Javafx Stage Exit Anfrage abbrechen
public void start(Stage stage) throws Exception {
FXMLLoader ldr = new FXMLLoader(getClass()
.getResource("Application.fxml"));
Parent root = (Parent) ldr.load();
appCtrl = (ApplicationController) ldr.getController();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
scene.getWindow().setOnCloseRequest(new EventHandler<WindowEvent>() {
public void handle(WindowEvent ev) {
if (!appCtrl.shutdown()) {
ev.consume();
}
}
});
}
nabil