paint() method of a JFrame object is used by
the Java system when it wants to paint on the monitor screen.
It is a mistake for you to call it directly.
The picture for this program is similar to that for the previous program.
TestFrame2 holds a static
which is where the program starts running.
Then an object
is constructed using
the class definition for
frame refers to this object.
Here is a picture of what is going on:
When the system decides to paint on the monitor screen,
it first does its work, then at the end calls the
method that is part of the
myFrame object in main memory.
drawString() method in
paint() puts some
text on the monitor.