import java.awt.event.*;
/** Listener der beim Druck auf einen Button eine
  * veraenderliche Label-Anzeige per Thread startet
  */
class KnopfListener implements ActionListener {
  ColorRunLabel crl;
  StartStopButton ssb;
  KnopfListener (ColorRunLabel crl, StartStopButton ssb) {
    this.crl = crl;
    this.ssb = ssb;
  }
  public void actionPerformed (ActionEvent e) {
    if (ssb.isStart()) // falls Start-Knopf
      crl.start();         // Thread des Labels starten
    else               // andernfalls 
      crl.stop();          // Thread des Labels abbrechen
    ssb.switchText();  // Beschriftung des Buttons wechseln
  }
}
