|
Is there a paint() method for this buttonDemo frame? A good answer might be:Yes---the standard paint() method inherited from the parent class, Frame. Since nothing special needs to be done, the inherited paint() works fine. Remember that it will automatically paint the frame and all the GUI components it contains. |
Program's Outputpaint() is called when the Java system knows that it must repaint the screen. It knows this when any of several things has happened:
Here is the output of the program. The original frame is on the left. On the right is the frame after the button has been clicked. Clicking on the frame's "close window" button closes the frame.
The button in the frame generates ActionEvents. The "close window" button (and the other two little buttons next to it) generate window events. You can't use the ActionListener interface for them. Sometimes the little buttons are called "icons" to make them distinct from class Button, who's objects are explicitly added to a container. |
QUESTION 11:(Memory Test: ) What is the name of the method that receives ActionEvents when a Button is clicked? Click Here after you have answered the question |