title: JavaFX - stage.show(); ending in program freezing
body: <p>I'm trying to write a class to open an external program, make a stage that says "Please wait" with a progress indicator, wait for it to finish, then exit the stage.  If I use <code>primaryStage.showAndWait();</code> the program works, but if I use <code>primaryStage.show();</code> the program freezes and won't continue until the class is closed.  Any help would be greatly appreciated. </p>
  
  <pre><code>package application;
  
  import javafx.geometry.Insets;
  import javafx.geometry.Pos;
  import javafx.scene.Scene;
  import javafx.scene.control.Label;
  import javafx.scene.control.ProgressIndicator;
  import javafx.scene.layout.HBox;
  import javafx.stage.Stage;
  
  import java.io.IOException;
  
  
  public class Wait {
  public static void display(String prog, String progPath){
      Stage primaryStage=new Stage();
  
  
  
      primaryStage.setTitle("Please Wait");
      primaryStage.setMinWidth(350);
  
      ProgressIndicator indicator = new ProgressIndicator();
  
      Label label1=new Label();
      label1.setText("Please wait for "+prog+" to finish...");
  
  
      HBox layout=new HBox(20);
      layout.getChildren().addAll(indicator, label1);
      layout.setAlignment(Pos.CENTER);
      layout.setPadding(new Insets(20,20,20,20));
  
      Scene scene =new Scene(layout);
      primaryStage.setScene(scene);
  
      primaryStage.show();// WHY U NO WORK?!?!?!?!
  
      try {
  
          Process p = Runtime.getRuntime().exec(progPath);
          p.waitFor();
  
  
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (InterruptedException e) {
          e.printStackTrace();
      }
  
      primaryStage.close();
  
  }
  }
  </code></pre>