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

Transparent or undecorated style stage is not shown on top of full-screen stage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 8u72
    • javafx

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


      ADDITIONAL OS VERSION INFORMATION :
      Linux ron-Linux-Laptop 4.2.0-30-generic #36~14.04.1-Ubuntu SMP Fri Feb 26 18:49:23 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      If a stage with transparent or undecorated style is shown on top of a full-screen stage, the transparent or undecorated stage is not visible, it seems to be hidden behind the full-screen stage.

      It seems to work however if (1) the stage style is changed to StageStyle.UTILITY or (2) if the parent stage is not full-screen,

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) create full screen stage and show it
      2) create transparent or undecorated style stage (initialize the owner to the full screen stage) and show it


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      transparent or undecorated style stage content should be visible
      ACTUAL -
      transparent or undecorated style stage is hidden behind the full-screen stage

      REPRODUCIBILITY :
      This bug can be reproduced always.

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

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Label;
      import javafx.stage.Modality;
      import javafx.stage.Stage;
      import javafx.stage.StageStyle;

      public class Main extends Application
      {
          private static Stage popupOwner;

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

          public static void showPopup(ActionEvent event)
          {
              Stage popupStage = new Stage();

              popupStage.setScene(new Scene(new Label("This is a popup.")));
              popupStage.initStyle(StageStyle.UNDECORATED);

              //note: uncomment the line below and the popup is always shown
              //popupStage.initStyle(StageStyle.UTILITY);

              popupStage.initModality(Modality.WINDOW_MODAL);
              popupStage.initOwner(Main.popupOwner);

              popupStage.show();
          }

          @Override
          public void start(Stage primaryStage) throws Exception
          {
              Main.popupOwner = primaryStage;

              Button button = new Button("Show popup");
              button.setOnAction(Main::showPopup);

              primaryStage.setScene(new Scene(button,200,100));

              //note: set fullscreen to false and the popup with transparent stage style is shown
              primaryStage.setFullScreen(true);

              primaryStage.show();
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      There is no workaround if a real transparent or undecorated stage is required.

      One fallback solution is to use UTILITY style stages (which show a close button and a title bar).
      Another fallback solution is to not initialize the owner of the transparent or undecorated stage but this will result in an automatic exit of the full-screen of the parent stage.

            ddhill David Hill (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: