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

[Win] StopWatch Sample scene image is not shown when stage is minimized while starting

XMLWordPrintable

    • x86_64
    • windows

      ADDITIONAL SYSTEM INFORMATION :
      NetBeans 8.2, Windows 10, JDK 8 Update 192

      A DESCRIPTION OF THE PROBLEM :
      If started minimized, the StopWatch sample does not paint its scene's image when it is restored.
      This occurs when StopWatch sample is modified to start minimized via stage.setIconified(true) in Application.start().

      This bug is similar to JDK-8095048 which is marked Resolved. The workaround from JDK-8095048 can be applied to this bug.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      One way to reproduce....
      1. NetBeans 8.2 > File > New Project... > Samples > JavaFX > Stopwatch
      2. Add stage.setIconified(true) to Application.start(), i.e.
          @Override public void start(Stage primaryStage) throws Exception {
      primaryStage.setIconified(true);
              init(primaryStage);
              primaryStage.show();
          }
      3. Run the StopWatch application, it will start minimized
      4. Click on StopWatch application icon in the Windows taskbar
      5. The StopWatch scene image is not painted
      6. Resize the StopWatch scene and it is repainted


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expect StopWatch scene to be painted after StopWatch application is restored from starting minimized

      ACTUAL -
      StopWatch scene is not painted after StopWatch application is restored from starting minimized


      ---------- BEGIN SOURCE ----------
      Replace JavaFX StopWatch sample's start() method with following start() method

          @Override public void start(Stage primaryStage) throws Exception {
      primaryStage.setIconified(true);
              init(primaryStage);
              primaryStage.show();
          }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Replace JavaFX StopWatch sample's start() method with following start() method

          @Override public void start(final Stage primaryStage) throws Exception {
      // https://bugs.java.com/view_bug.do?bug_id=8095048
      primaryStage.iconifiedProperty().addListener(new ChangeListener<Boolean>()
      {
      @Override
      public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue)
      {
      // if (stage.isIconified())
      if (!newValue)
      {
      primaryStage.setResizable(!primaryStage.isResizable());
      primaryStage.setResizable(!primaryStage.isResizable());
      }
      }
      });

      primaryStage.setIconified(true);
              init(primaryStage);
              primaryStage.show();
          }



      FREQUENCY : always


            arapte Ambarish Rapte
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: