To include a handler method for ActionEvents in your applet, you first add to your applet header that you are going to "implement" this interface: public class ButtonTest extends Applet implements ActionListener |
This means that your applet must include a handler method called actionPerformed. Its argument is an ActionEvent, which has methods to give information about the event: public void actionPerformed ( ActionEvent event ) { if ( event.getSource ( ) == button1 ) { // code executed when button1 is pressed } . . . } |