title: Concurrency in Java(FX)
body: <p>In my JavaFX application I want to display an intermediate ProgressIndicator, while loading data from a database for instance. I tried to solve this problem by setting a different fxml-file (indicator.fxml), containing a ProgressIndicator with intermediate property, into the main BorderPane. And after that, setting the desired Stage into the BorderPane.</p>
  
  <p>The indicator.fxml gets displayed, but seems to be frozen, because it is not animating. PersondataController controller = loader.getController() takes some time to be finished.</p>
  
  <pre><code>@FXML
  private void showPersonData(){
      try{
          FXMLLoader loader2 = new FXMLLoader();
          loader2.setLocation(RootLayoutController.class.getResource("Indicator.fxml"));
          AnchorPane progress = loader2.load();
          mainApp.getRootLayout().setCenter(progress);´
  
          Platform.runLater(new Runnable() {
              @Override
              public void run() {
                  FXMLLoader loader = new FXMLLoader();
                  loader.setLocation(RootLayoutController.class.getResource("Persondata.fxml"));
                  PersondataController controller = loader.getController();
  
                  AnchorPane page = null;
                  try {
                      page = loader.load();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                  mainApp.getRootLayout().setCenter(page);
              }
          });
  
      }catch(Exception e){
          e.printStackTrace();
      }
  </code></pre>
  
  <p>Any ideas how I can solve this problem?</p>