main() method.
Instead they must have a class which extends the built-in class
JApplet. (This requires an import statement: import
javax.swing.JApplet;.)
This class in turn extends the graphical class Panel, so your
applet class can call or redefine all of the methods that Panel
has.
JApplet class does not need a constructor. Instead
you can put things that would appear in a constructor in the class's
init() method, which is automatically executed when the
applet is accessed.
JApplet methods are the following. Each can be
defined in a class that extends Applet.
init(). This gets called when the applet
is first created and loaded by the underlying software.
It performs one-time operations.start() This gets called when the applet is visited, for
example, when the user goes to the webpage with the applet.
After start() executes, the applet's paint method
gets called.
stop(). This staps the applet, but does not get rid of it,
whenever the user leaves the webpage with the applet.
destroy(). This is called when the browser exits.
It's the place to put clean-up operations.