The Department of Computer Science & Engineering
|
|
STUART C. SHAPIRO: CSE
115 C
|
If button is a JButton, add an ActionListener by doing
button.addActionListener(listener), where
listener is an instance of a class that implements the java.awt.event.ActionListener
Interface.
The only method specified by the ActionListener
Interface is public void
actionPerformed(java.awt.event.ActionEvent e). When you
implement an ActionListener's actionPerformed method, you may ignore
the e parameter, which you are advised to do for now.
Otherwise the actionPerformed method may do anything, including
manipulate other objects it knows about.