package test; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; public class RT_19783 extends Application { @Override public void start(final Stage primaryStage) throws Exception { VBox root = new VBox(); Button button = new Button("Open Modal Window"); root.getChildren().add(button); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { VBox root = new VBox(); Button button = new Button("Close"); root.getChildren().add(button); Label label = new Label("I am blocking!"); root.getChildren().add(label); button.setOnAction(new EventHandler() { @Override public void handle(ActionEvent event) { ((Button)event.getSource()).getScene().getWindow().hide(); } }); Stage modalWindowStage = new Stage(); modalWindowStage.setScene(new Scene(root)); modalWindowStage.initOwner(((Button)event.getSource()).getScene().getWindow()); modalWindowStage.initModality(Modality.APPLICATION_MODAL); // WINDOW_MODAL also fails modalWindowStage.show(); label.setText("I am not blocking!"); } }); primaryStage.setScene(new Scene(root)); primaryStage.show(); } public static void main(String[] args) { launch(); } }