(^670) | Applets
Calculator
We ran the calculator applet within a viewer provided by our particular Java system. Figure
14.4 shows the .htmlfile that was automatically generated by our Java system when the cal-
culator applet was compiled.
Although this HTML document is a little different, the important element is: the applet
tag with the name of the file with a .classextension. Notice the two-stage process:
1.Compile the Java code into Bytecode.
2.Create an HTML document with a link to the Bytecode file in the Web page.
Figure 14.4 .htmlfile for running the calculator applet
<title>Calculator2.class</title>
<hr>
<applet codebase="Java Classes" code="Calculator2.class" width=200 height=200>
</applet>
<hr>
<a href="Calculator2.java">The source.</a>
T
E
A
M
F
L
Y
Team-Fly®