





























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






























public class SwingApplication implements ActionListener { ... JButton button = new JButton("I'm a Swing button!"); button.addActionListener(this); .... public void actionPerformed(ActionEvent e) { numClicks++; label.setText(labelPrefix + numClicks); } }
ActionListener
User closes a frame WindowListener Clicking a mouse button, while the cursor is over a component
MouseListener
Act causing Event Listener Type
User moving the mouse over a component
MouseMotionListener
Component becomes visible ComponentListener
Table or list selection changes ListSelectionListener
Example: public void actionPerformed(ActionEvent e) The above code contains the handler for the ActionEvent e that occurred.