Not really.
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.
ButtonFrame
extends the class JFrame
.main()
is a static member of the ButtonDemo
class,
not part of any object.main()
contains a reference variable
frm
, which refers to a ButtonFrame
object.
ButtonFrame
frame and its button
are displayed on the screen.
ButtonFrame
object.
ButtonFrame
object is registered as a listener for Action Events.ButtonFrame
class implements ActionListener
.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.
(Thought question: ) Could the static main()
method
be defined as part of the ButtonFrame
class?
(So that a separate ButtonDemo
class is not needed.)