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

[macos] Stages with StageStyle.UTILITY are always on-top when initialized without an owner

    Details

      Backports

        Description

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

        ADDITIONAL OS VERSION INFORMATION :
        15.6.0 Darwin Kernel Version 15.6.0: Fri Feb 17 10:21:18 PST 2017; root:xnu-3248.60.11.4.1~1/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        If you create a stage with StageStyle.UTILITY, it is always on-top if it doesn't have an owner. Not only is it on-top of other javafx stages but also all other applications.

        This may be intended but is entirely undocumented that the style will change how the window operates. Documentation makes it seem the stage style is cosmetic only.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        package sample;

        import javafx.application.Application;
        import javafx.stage.Modality;
        import javafx.stage.Stage;
        import javafx.stage.StageStyle;

        public class Main extends Application {

            @Override
            public void start(Stage primaryStage) throws Exception{
                primaryStage.setTitle("Hello World");
                primaryStage.show();

                Stage dummyStage = new Stage();
                dummyStage.initModality(Modality.NONE);
                // by setting this to utility the stage will now always be on-top of other applications
                // may not intended but it is not documented to do that
                dummyStage.initStyle(StageStyle.UTILITY);
                dummyStage.setAlwaysOnTop(false);
                dummyStage.show();

                dummyStage.requestFocus();
            }


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

        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Create a dummy stage that is transparent with width/height 0/0 and set it as the owner of the window.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  azvegint Alexander Zvegintsev (Inactive)
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: