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

Mac: Closing an APPLICATION_MODAL window in OS X causes all other windows to cycle to the front


    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 8
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      OS X 10.9, Java 1.8.0ea b117


      If you close an APPLICATION_MODAL stage in OS X it appears that all other application stages cycle to the front. If you have more than one stage open this causes a very noticeable flicker as the stage re-shuffle.

      I can understand that closing a modal dialog should ensure its owner is now in the front but bring up all other stages seems excessive especially if it cannot be done without causing the flicker apparent on OS X.

      Please run the following test case and then click on the button to open an app modal dialog. When you click on the close button to close the dialog you will see all the visible stages flicker to the front as they appear to re-shuffle.

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Pos;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.Region;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.text.Text;
      import javafx.stage.Modality;
      import javafx.stage.Stage;

      public class ModalityTest extends Application {

         public void start(final Stage primaryStage) throws Exception {

            double x = 0;
            double y = 0;
            for (int i = 0; i < 4; i++) {
               Stage stage = new Stage();
               Text text = new Text("" + i);
               text.setStyle("-fx-font-size: 3.0em;");
               StackPane pane = new StackPane(text);
               stage.setScene(new Scene(pane, 400, 300));
               if ( x != 0 ) {
                  stage.setX(x + 50);
                  stage.setY(y + 50);
               x = stage.getX();
               y = stage.getY();

            Button button = new Button("Dialog...");
            button.setOnAction(new EventHandler<ActionEvent>() {
               public void handle(ActionEvent event) {
                  final Stage dialog = new Stage();
                  Button b = new Button("Close");
                  b.setOnAction(new EventHandler<ActionEvent>() {
                     public void handle(ActionEvent event) {
                  dialog.setScene(new Scene(new StackPane(b), 100, 50));
                  dialog.setX(primaryStage.getX() + 100);
                  dialog.setY(primaryStage.getY() + 50);
            Text text = new Text("primary");
            text.setStyle("-fx-font-size: 3.0em;");
            VBox box = new VBox(20, text, button);
            box.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
            primaryStage.setScene(new Scene(new StackPane(box), 400, 300));
            primaryStage.setX(x+ 50);
            primaryStage.setY(y + 50);



         public static void main(String[] args) throws Exception {




            • Assignee:
              aniyogi Avik Niyogi (Inactive)
              csmithjfx Charles Smith (Inactive)
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: