In testing RT-33261, I set up a simple test where an indeterminate ProgressIndicator was removed from the scene and was then added back. It is reasonable to expect that the ProgressIndicator should be spinning when it is re-added to the scene, but it is not. Only by requesting a layout on the ProgressIndicator after it was re-added could I get the indicator to spin.
@Override public void start(Stage stage) throws Exception {
final root = new VBox();
final ProgressIndicator progressIndicator = new ProgressIndicator(-1);
progressIndicator.setMaxSize(150, 150);
progressIndicator.visibleProperty().addListener((b,o,n)->{
System.out.println("Main: progressIndicator visibleProperty: " + n);
});
Button button = new Button("remove/add");
button.setOnAction((e) -> {
Parent parent = progressIndicator.getParent();
if (parent != null) root.getChildren().remove(progressIndicator);
else root.getChildren().add(progressIndicator);
// progressIndicator.requestLayout();
});
root.getChildren().addAll(button, progressIndicator);
Scene scene = new Scene(root, 200,200);
stage.setScene(scene);
stage.show();
}
@Override public void start(Stage stage) throws Exception {
final root = new VBox();
final ProgressIndicator progressIndicator = new ProgressIndicator(-1);
progressIndicator.setMaxSize(150, 150);
progressIndicator.visibleProperty().addListener((b,o,n)->{
System.out.println("Main: progressIndicator visibleProperty: " + n);
});
Button button = new Button("remove/add");
button.setOnAction((e) -> {
Parent parent = progressIndicator.getParent();
if (parent != null) root.getChildren().remove(progressIndicator);
else root.getChildren().add(progressIndicator);
// progressIndicator.requestLayout();
});
root.getChildren().addAll(button, progressIndicator);
Scene scene = new Scene(root, 200,200);
stage.setScene(scene);
stage.show();
}
- duplicates
-
JDK-8095968 ProgressIndicator in indeterminate mode is not spinning
-
- Resolved
-