Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088042

[Mac] Dismissing a modal dialog created by another modal dialog causes a beep

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 8u60
    • 8u40
    • javafx
    • MacOSX 10.9.5
      Java 8U40

      The following code demonstrates the bug. Run the code. Click in the button in the window and a confirmation alert appears. Click in either button of the alert and an error alert appears. Now click OK in the error alert to dismiss it (and the confirmation alert). When you do so, a beep is sounded, as if you had attempted to click in a window covered by the modal alert dialog. I cannot reproduce this bug on Windows 7 x64 Service Pack 1 and so it seems to be Mac-specific.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Button;
      import javafx.stage.Stage;

      public class ModalDialogExample extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage primaryStage) {
              Button button = new Button("Press me");
              button.setOnAction(event -> {
                  Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
                  alert.setOnCloseRequest(event1 -> {
                      Alert alert1 = new Alert(Alert.AlertType.ERROR);
                      alert1.showAndWait();
                  });
                  alert.showAndWait();
              });

              Scene scene = new Scene(button, 100, 100);
              primaryStage.setScene(scene);
              primaryStage.setTitle("ModalDialogExample");
              primaryStage.show();
          }
      }

            ckyang Chien Yang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: