No. Often nothing changes.
The Java system automatically paints the frame when any of several things has happened:
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 top. On the bottom is the frame after the button has been clicked. Additional clicks do nothing. Although the events are handled, all that happens is that the frame is set to blue each time. Clicking on the frame's close window button closes the frame.
(Memory Test: ) What is the name of the method that receives
ActionEvent
s when a button is clicked?