This is the main window of my application:
I want to be able to update the window, so i wrote a method reset
which ist triggered by pressing F5:
public void reset() {
final ProgressIndicator pi = new ProgressIndicator(-1.0f);
final HBox hb = new HBox(pi);
final VBox vb = new VBox(hb);
hb.setAlignment(Pos.CENTER);
vb.setAlignment(Pos.CENTER);
scene.setRoot(vb);
//this.show();
}
if i run this it looks sth like this:
However, if I uncomment the line //this.show();
this will be executed:
public void show() {
final VBox box = API_CALL_AND_BUILDING_BOX_MAGIC_WHICH_I_STRIPPED;
gp.getChildren().clear();
gp.getChildren().add(box);
scene.setRoot(gp);
stage.sizeToScene();
}
and I will never be able to see my ProgressIndicator because the application will just hang until the APIcall is finished and the new content is loaded.
I tried a bit with Threads and Platform.runLater() but I cant get it to work. My goal is to display the ProgressIndicator until the APIcall is finished, the box is build and the scene gets given gp
as the new root.
I hope its somewhat understandable what my goal and my problems are :)