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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u40
    • Fix Version/s: 8u60
    • Component/s: javafx
    • Labels:
    • Environment:

      MacOSX 10.9.5
      Java 8U40

      Description

      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();
          }
      }

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported: