title: How do I "restart" a JavaFX Application?
body: <p>I've been coding a simulation in Java and now generate graphs of the results in JavaFX. However, I'm stumped as to how to call the graphs so that when I try to run the simulation (and generate the graphs) for a second time, I don't get the "can't call launch() more than once" error. I read that launch() can only be called once, so what do I need to change to call the graphs successfully on a second run of the simulation?</p>
  
  <pre><code>public class AnswerWorker extends SwingWorker&lt;Void, Integer&gt; {
  
  protected Void doInBackground() throws Exception
  {
      AMEC.runsimulation();
      return null;
  }
  
  protected void done()
  {
  try {
      Graphs.launch(Graphs.class, "");
      JOptionPane.showMessageDialog(InputGUI.this, AMEC.unsuccesfulpercentage + "% of iterations had trucks that had to sleep over");
      AMEC.unsuccesfulpercentage = 0;
      }
      catch (Exception e)
      {
          e.printStackTrace();
      }
  
  }
  }
  </code></pre>
  
  <p>with a pretty standard graphing class:</p>
  
  <pre><code>public class Graphs extends Application {
  
      @Override public void start(Stage stage) {
      ....
      stage.show();
      }
  }
  </code></pre>