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

[macos] Alerts are shown as separate Tab in fullscreen mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 8, openjfx14
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:
      None
    • Environment:

      macOS High Sierra 10.13.6 (17G11023)

       javafx-14.0.1

      openjdk-14

      Description

      When entering fullscreen mode on MacOS, dialogs/alerts are not shown correctly.
      Instead a separate tab is opened where the content of the dialog is shown.

      The following example program shows the problem:

      package prv.rli.codetest;

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Alert;
      import javafx.scene.control.Alert.AlertType;
      import javafx.scene.control.ButtonBar.ButtonData;
      import javafx.scene.control.ButtonType;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.input.KeyCombination;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class DialogConfirmDangerousAction extends Application {

          public DialogConfirmDangerousAction() {
          }

          @Override
          public void start(Stage stage) throws Exception {
              stage.setTitle("Dialog default button");
              Scene scene = new Scene(new VBox(), 400, 350);
       
              MenuBar menuBar = new MenuBar();
       
              // --- Menu File
              Menu menuFile = new Menu("File");
              menuBar.getMenus().addAll(menuFile);
              
              MenuItem test = new MenuItem("Open Dialog");
              test.setAccelerator(KeyCombination.keyCombination("Ctrl+O"));
              test.setOnAction(new EventHandler<ActionEvent>() {
                  public void handle(ActionEvent t) {
               Alert alert = new Alert(AlertType.CONFIRMATION);
               alert.setTitle("Really");
               alert.setHeaderText("Danger, Will Robinson");
               alert.setContentText("This will make the universe collapse. Are you sure?");
               ButtonType yes = new ButtonType("Yes", ButtonData.OTHER);
               ButtonType no = new ButtonType("No", ButtonData.CANCEL_CLOSE);
               alert.getButtonTypes().setAll(no, yes);
                   alert.showAndWait();
                  }
              });
              
              menuFile.getItems().add(test);
       
              ((VBox) scene.getRoot()).getChildren().addAll(menuBar);
       
              stage.setScene(scene);
              stage.show();
          }
          
          public static void main(String[] args) {
              launch(args);
          }
      }

      If it is started, fullscreen mode is entered and the menu item activated, the dialog is shown as described above.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kcr Kevin Rushforth
              Reporter:
              rlichten Robert Lichtenberger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: