The last step is to connect the button to the actionPerformed method by registering that the applet is the class ready to "listen" for button events: button1.addActionListener ( this ) ; |
The keyword this refers to the current applet. |
Note that many buttons can add ActionListener and the one actionPerformed method should have code sections for each button. |