|
Code Samples Index
These code examples and other materials are subject to Sun Microsystems, Inc.
Legal Terms
Handling Action Events
Action events are fired by subclasses of AbstractButton and includes buttons, checkboxes, and menus.
AbstractButton button = new JButton("OK");
button.addActionListener(new MyActionListener());
public class MyActionListener implements
ActionListener {
public void actionPerformed(ActionEvent evt) {
// Determine which abstract button fired the
// event.
AbstractButton button = (
AbstractButton)evt.getSource();
}
}
|
Examplets provided by permission of the publisher, Addision-Wesley, and Author Patrick Chan.
Order this book from Amazon
|