@SuppressWarnings("deprecation")
    @Override
    public void actionPerformed(ActionEvent e) {

      if (!(e.getSource() instanceof StartButton)) return;

      StartButton button = (StartButton) e.getSource();

      if (thread == null) {
        thread = new SimulationThread();
        onSimulationStart();
        button.setStopText();
        thread.start();
      } else {
        onSimulationStop();
        button.setStartText();
        thread.stop();
        thread = null;
      }
    }
 public void setStartButton(StartButton button) {
   button.addActionListener(new SimulationLauncher());
 }