コード例 #1
0
    @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;
      }
    }
コード例 #2
0
 public void setStartButton(StartButton button) {
   button.addActionListener(new SimulationLauncher());
 }