Answer:
Not really.
Picture of the Relations
Perhaps a picture is needed. Clouds represent class definitions, solid rectangles represent objects, and dotted rectangles represent the static part of a class. Look back at the example program as you study the diagram.
ButtonFrameextends the classJFrame.main()is a static member of theButtonDemoclass, not part of any object.main()contains a reference variablefrm, which refers to aButtonFrameobject.- The
ButtonFrameframe and its button are displayed on the screen. - Events from the button are sent to the
ButtonFrameobject.- The
ButtonFrameobject is registered as a listener for Action Events. - The
ButtonFrameclass implementsActionListener.
- The
Don't be discouraged if this is less than perfectly clear! It usually takes some time to get all of these relationships straight. A bit more practice would not hurt, either.
QUESTION 18:
(Thought question: ) Could the static main() method
be defined as part of the ButtonFrame class?
(So that a separate ButtonDemo class is not needed.)