Java Reference
In-Depth Information
The
width
and
height
statements specify the dimensions of the display area used by the
applet.
To execute
SimpleApplet
with an applet viewer, you will execute this HTML file. For
example, if the preceding HTML file is called
StartApp.html
, then the following com-
mand line will run
SimpleApplet
:
Although there is nothing wrong with using a stand-alone HTML file to execute an ap-
plet, there is an easier way. Simply include a comment near the top of your applet's source
code file that contains the APPLET tag. If you use this method, the
SimpleApplet
source
file looks like this:
Now you can execute the applet by passing the name of its source file to
appletviewer
.
For example, this command line will now display
SimpleApplet
:
The window produced by
SimpleApplet
, as displayed by
appletviewer
, is shown in the
following illustration: