e644. 处理Action事件
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();
}
}
Related Examples |