I have the following code:
JButton button = new JButton(\"Clear\");
button.addActionListener(this);
As far as I understand I create a butto
Each JButton, has an EventListenerList. Calling addActionListener(this)
adds your ActionListener, a callback function named actionPerformed()
, to the list. You can see an outline of the code that calls your method here. The actual fireActionPerformed()
method is in AbstractButton. A JButton is a JComponent, which you can see listed among the various classes that use the event listener list mechanism.