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

ProgressIndicator does not animate if you set setVisible(false) before showing stage

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 9
    • 8
    • javafx

      I created a ProgressIndicator with setProgress(-1) and add it to a StackPane. If I do "setVisibility(false)" before showing the stage and do "setVisible(true)" after showing the stage, the ProgressIndicator is showing but not animating.

      It works only if I do "setVisible(false)" AFTER showing the stage.

      Here my test code:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.ProgressIndicator;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      public class TestProgressIndicator extends Application
      {

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

          @Override
          public void start(Stage primaryStage)
          {
              final ProgressIndicator pi = new ProgressIndicator();

              Button b = new Button("Show ProgressIndicator");
              b.setOnAction(new EventHandler<ActionEvent>()
              {
                  @Override
                  public void handle(ActionEvent actionEvent)
                  {
                      pi.setVisible(true);
                  }
              });

              StackPane mp = new StackPane();
              mp.getChildren().addAll(pi, b);

              Scene scene = new Scene(mp, 320, 480);

              primaryStage.setScene(scene);

              pi.setVisible(false); //doesn't work
              primaryStage.show();
              //pi.setVisible(false); //works
          }
      }

            jgiles Jonathan Giles
            tobijfx Tobi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: