Answer:
Visually nothing happens. The actionPerformed()
method is called with a new Event object,
but it changes nothing.
If you feel like some fun,
modify the code so that each click changes the background color.
Program's Output
The Java system automatically paints the frame when any of several things has happened:
- The frame has just been created.
- The frame has been maximized.
- The frame was previously hidden behind another frame and has just been exponsed.
However, a mere button click does not necessarily mean that a frame should be
repainted.
If it does, as it does in this program, call repaint()actionPerformed()
The pictures show the output of the program. The original frame is on the left. On the right is the frame after a button click.
QUESTION 16:
(Memory Test: ) What is the name of the method that receives
ActionEvents when a button is clicked?