Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

Essential.

First, a java.lang.String is declared and initialized.

Then the class's constructor is executed.

Same name as the class itself.

The applet instance running is registered as MouseListener,....

to have its mouse methods called.

When a mouse method is called, it receives a reference to a MouseEvent object.

We ask the one that we get in the mouseClicked method for the click coordinates by calling its methods getX and getY ......

and make a new String .

Then we ask the applet to paint itself as soon as possible .

The paint method will be executed, where the String is drawn, starting at 10 pixels from the left side of the applet and 20 pixels below its top .

=======

NOTES

=======

Click in the applet's corners to see the coordinate system used : left-top = 0,0 .

The mouse arrow's tip is its sensitive spot . Try clicking 399, 149 , if you're not nervous .

=======

As the String reference variable strpaint is declared outside the methods,....

it can be used in all methods . Its SCOPE is the class.

=======

LOCAL, TEMPORARY variables . Local to the method .

Used.

And discarded when the method ends .

Their scope is the method .

=======

Concatenation, conversion to String .

=======

Like Applet and Graphics, java.awt.event.MouseEvent is a class in the Java library on your station.

So is java.awt.Color .

.