3 Replies Latest reply: Jul 8, 2013 3:36 AM by eno g. - oracle RSS

    Window not refreshing after lock/unlock screen.

    async
      I've noticed an issue where if I lock the screen (windows key + L) before the visible property of some component is changed, then unlock the screen, the component visibility is not updated until I mouse over the JavaFX application window.

      I'm including some sample code to demonstrate the problem. To use:
      1. Run.
      2. Click the button.
      3. Lock the screen.
      4. Wait 15 seconds.
      5. Unlock the screen, but do not touch the mouse.
      6. Verify that the progress indicator animation is still visible, but is not animated.
      7. Mouse over the application window.
      8. Verify that the progress indicator disappears.

      In addition, if steps 3-7 are not executed, the behavior is as I would expect... The progress indicator disappears 15 seconds after the button is clicked.

      Does anyone have any ideas on a workaround that would force a UI update when the screen is unlocked?

      I'm using the version of JavaFX packaged with Java 1.7.0_09
      /**
       * App javadoc goes here..
       *
       */
      public class App extends Application
      {
          /**
           * @param args
           */
          public static void main( String[] args )
          {
              Application.launch(args);
          }
      
          /**
           * 
           */
          @Override
          public void start(Stage stage) throws Exception {
              VBox root = new VBox();
              
              final ProgressIndicator pi = new ProgressIndicator();
              pi.setMaxSize(300d, 300d);
              pi.setStyle("-fx-progress-color: dodgerblue;");
              
              Button button = new Button("Hide after 15 seconds...");
              button.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {
                      pi.setVisible(true);
                      Thread t = new Thread(new Runnable() {
                          @Override
                          public void run() {
                              try {
                                  Thread.sleep(15000);
                              } catch (InterruptedException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                              } finally {
                                  Platform.runLater(new Runnable() {
                                      @Override
                                      public void run() {
                                          pi.setVisible(false);
                                      }
                                  });
                              }
                          }
                      });
                      t.start();
                  }
              });
              
              root.getChildren().addAll(pi, button);
              
              Scene scene = new Scene(root);
              stage.setTitle("Lock/Unlock Windows Issue");
              stage.setScene(scene);
              stage.show();
          }
      }