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

The method setAlwaysOnTop failed to work properly while the method setFullScreen is true

    XMLWordPrintable

    Details

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)



      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.14393]

      A DESCRIPTION OF THE PROBLEM :
      I have

      1) a primary stage which the user can configure to be in fullscreen mode
      2) secondary stages (non modal tool windows) which the user can open. These windows should be always on top the the primary stage

      2) does not work when the primary stage is in fullscreen mode. The tool stages are correctly configured with initOwner and setAlwaysOnTop but they disappear behind the primary stage whenever the user clicks on it

      See also
      http://stackoverflow.com/questions/38810758/how-to-make-non-modal-stage-appear-always-on-top-of-javafx-fullscreen-stage

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a primary stage s1. Set to full screen.
      Create a secondary stages s2 with s1 being owner. Set setAlwaysOnTop for s2 to true.

      See also, attached test source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Non modal stages for which setAlwaysOnTop is called should always appear in front of their owner stage regardless of whether it is in fullscreen mode or not
      ACTUAL -
      Non modal stages for which setAlwaysOnTop is called should only appear in front of their owner stage if the owner is not in fullscreen mode

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
          import javafx.scene.Scene;
          import javafx.scene.control.Button;
          import javafx.scene.control.Label;
          import javafx.scene.layout.VBox;
          import javafx.stage.Stage;

          public class Test extends Application {
              @Override
              public void start(Stage stage) {
                  VBox vbox = new VBox();
                  Scene scene = new Scene(vbox);
                  stage.setScene(scene);
                  Button button1 = new Button("New Tool Window");
                  button1.setOnAction((e)-> {
                      Stage toolStage = new Stage();
                      Scene toolScene = new Scene(new Label("Am I on top?"),300, 250);
                      toolStage.setScene(toolScene);
                      toolStage.initOwner(stage);
                      toolStage.setAlwaysOnTop(true);
                      toolStage.show();
                  });
                  Button button2 = new Button("Close");
                  button2.setOnAction((e)->System.exit(0));
                  vbox.getChildren().addAll(button1,button2);
                  stage.show();
                  stage.setFullScreen(true);
              }

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

      CUSTOMER SUBMITTED WORKAROUND :
      I tried many workarounds with listeners to always bring the tool stage back to front but nothing worked so far

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated: