Answer:
actionPerformed()
Review of actionPerformed()
The parameter for actionPerformed()
is a reference to an ActionEvent object,
a subclass of AWTEvent.
When a button is clicked,
actionPerformed() is called with a new ActionEvent parameter.
So far,
we've not used the
ActionEvent object.
We will do this shortly.
Here is the picture:
The registered ActionListener may be the object
that contains the button.
For small applications, this is an object
of a type that is a subclass of JFrame.
(In other words, you define a class based
on JFrame.)
The class contains the button
and also implements the ActionListener interface.
In larger applications, the registered listener may be in
a class by itself, or be in a JPanel.
See the following chapters.
QUESTION 2:
Could a frame hold two buttons?