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

Closing an APPLICATION_MODAL window brings all latest created window to top

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 7u25
    • Fix Version/s: None
    • Component/s: javafx
    • Environment:

      windows 7

      Description

      I have a strange behavior while closing an APPLICATION_MODAL window which have an owner (parent) window.
      I was expected that its parent will remain on top of all other windows but instead others are brought to top without any Event.


      Here is the sample code I used to reproduce this behavior, close the "Child" window and look how "free" windows behave.

      package mypkg;

      import javafx.application.Application;
      import javafx.event.Event;
      import javafx.event.EventHandler;
      import javafx.stage.Modality;
      import javafx.stage.Stage;
      import javafx.stage.StageBuilder;

      public class WinHierarchy extends Application {

      /**
      * @param args
      */
      public static void main(String[] args) {
      // TODO Auto-generated method stub
      launch(WinHierarchy.class, args);

      }

      @Override
      public void start(Stage primaryStage) throws Exception {

      Stage stage = StageBuilder.create().title("Child").build();
      primaryStage.setTitle("Parent");
      stage.initOwner(primaryStage);
      stage.initModality(Modality.APPLICATION_MODAL);

      primaryStage.show();

      // USED TO TRACK EVENTS
      applyEventFilter(stage);
      applyEventFilter(primaryStage);

      buildFreeWindow(5);
      stage.showAndWait();
      }

      private void buildFreeWindow(int count) {
      for (int i = 0; i < count; i++) {

      Stage free = StageBuilder.create().title("free").build();
      applyEventFilter(free);
      free.show();
      }
      }

      private void applyEventFilter(Stage stage) {
      stage.addEventFilter(Event.ANY, new EventHandler<Event>() {

      @Override
      public void handle(Event event) {
      System.out.println(event);
      }

      });
      }

      }

        Attachments

          Activity

            People

            • Assignee:
              art Artem Ananiev
              Reporter:
              jaitjfx Jamal Ait (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: