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

JavaFX Windows - Stage shown when screen is asleep will be blank on wakeup

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      other

      Description

      FULL PRODUCT VERSION :
      jdk build 1.8.0_121-b13

      ADDITIONAL OS VERSION INFORMATION :
      Windows 10 - (ver. 10.0.14393)
      Windows 7 - (ver. 6.1.7601)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      N/A - Problem is present with very simple JavaFX implementation.

      A DESCRIPTION OF THE PROBLEM :
      On Windows, if a new Stage is shown when the screen (desktop monitor) goes to sleep and the screen is later woken up (jiggle mouse) the stage will be blank, i.e. just a white screen.

      If the blank stage is later resized the contents of the scene will draw.

      The problem is when a new stage is shown when the screen is asleep.
       

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) On Windows, set the screen to go to sleep after 1 min, the shortest time possible. This option is "Turn off the display" option in Windows control panel. The computer should still be on, only the screen should sleep.

      2) Start a JavaFX application, you can allow the primary stage to show and create a new Thread that sleeps for 2 mins.

      3) After the thread has slept for 2 mins (NOTE: The screen should be asleep/turned off at this point) create a new stage with a label and show it.

      4) Jiggle the mouse to wake up the screen. You will see the newly created stage will be blank (white) and your label will be missing.

      5) Resize the newly created stage, the contents will draw.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A stage should be drawn correctly when the screen awakes from sleep. A user should NOT have to resize the stage to get the contents to draw.
      ACTUAL -
      The newly created stage is blank (white) when the screen wakes up.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.stage.Stage;

      public class DemoApplication extends Application {

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

          @Override
          public void start(Stage primaryStage) throws Exception {
              Parent parent = new Label("This is the main window");
              Scene rootScene = new Scene(parent, 400, 200);
              primaryStage.setScene(rootScene);
              primaryStage.show();

              // Start a thread that will create a new window at some later time (Please follow comments in thread)
              new Thread(() -> {
                  try {
                      Thread.sleep(1000 * 60 * 2); // Wait until screen is asleep (I set my screen to sleep after 1 minute)

                      // Screen (desktop monitor) MUST fall asleep before this Platform.runLater() is called!
                      Platform.runLater(() -> {
                          Stage issueStage = new Stage();
                          Parent newParent = new Label("This label won't display if stage appears when Monitor is asleep");
                          issueStage.setScene(new Scene(newParent, 400, 150));
                          issueStage.show();
                      });
                      // After the Platform.runLater() is called, jiggle your mouse to wake up the monitor.
                      // The stage will not show the label until you resize the stage
                  } catch (InterruptedException e) {
                      
                  }
              }).start();
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      None known.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: