Java Reference
In-Depth Information
ch02/applet/RectangleAppletExplained.html
1 <html>
2 <head>
3 <title>Two rectangles</title>
4 </head>
5 <body>
6 <p>Here is my <i>first
applet</i>:</p>
7 <applet code=ÐRectangleApplet.classÑ
width=Ð300Ñ height=Ð400Ñ>
8 </applet>
9 </body>
10 </html>
An HTML file can have multiple applets. Simply add a separate applet tag
for each applet.
You can give the HTML file any name you like. It is easiest to give the HTML
file the same name as the applet. But some development environments already
generate an HTML file with the same name as your project to hold your
project notes; then you must give the HTML file containing your applet a
different name.
To run the applet, you have two choices. You can use the applet viewer, a
program that is included with the Java Software Development Kit from Sun
Microsystems. You simply start the applet viewer, giving it the name of the
HTML file that contains your applets:
appletviewer RectangleApplet.html
64
Search WWH ::




Custom Search