public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (source == layoutBut) {
      do_layout();
    } else if (source == runBut) {
      sim_setup();
      Sim_system.set_auto_trace(false);
      Sim_system.generate_graphs(false);
      layoutBut.setEnabled(false);
      stopBut.setEnabled(true);
      pauseBut.setEnabled(true);
      paused = false;
      runBut.setEnabled(false);
      if (simThread == null) {
        simThread = new Thread(this);
      }
      simThread.start();
    } else if (source == stopBut) {
      stopped = true;
      paused = false;
      stopBut.setEnabled(false);
      pauseBut.setEnabled(false);
      runBut.setEnabled(false);
    } else if (source == pauseBut) {
      if (paused) {
        paused = false;
        pauseBut.setLabel("Pause");
      } else {
        paused = true;
        pauseBut.setLabel("Restart");
      }
    }
  }