Пример #1
0
  public void actionPerformed(ActionEvent evt) {

    // if start is pressed, activate run method
    if (evt.getActionCommand().equals("Start")) {

      start();
    }
    // if stop is pressed, stop all of the balls
    // and change color.
    if (evt.getActionCommand().equals("Stop")) {

      stop();
      changeColor();
    }
    // if clear all is pressed, clear all of the balls
    // from the canvas.
    if (evt.getActionCommand().equals("Clear All")) {

      ball.removeFromCanvas();
    }
  }