Java Reference
In-Depth Information
3. Click the Save button in the Save As dialog box.
TextPad saves the file on the Data Disk in drive A. The file name is displayed
in the title bar of the TextPad window.
4. In the TextPad coding window, type the HTML code as shown in
Figure 2-57 on page 102.
The code for the HTML host document is displayed in the TextPad coding
window (Figure 2-60).
Java class
name
Save
button
APPLET start
and end tags
new code
CODE
attribute
WIDTH and
HEIGHT attributes
FIGURE 2-60
5. Click the Save button on the Standard toolbar.
The <APPLET> tag, nested within the <HTML> start and end tags, specifies
three pieces of information that the Web page will need in order to access the
Java applet: the name of the Java bytecode file and the width and height of the
window in which to run the applet (Figure 2-57 on page 102).
The name of the Java bytecode file is specified using the CODE attribute of
the <APPLET> tag. HTML and its tags generally are not case-sensitive. The
name of the referenced class, however, must match exactly because it is a Java
class.
The width and height of the window in which to run the applet are specified
using the WIDTH and HEIGHT attributes of the <APPLET> tag. The values
specified for the width and height are measured in pixels.
Running an Applet
As you have learned, an applet is run by first running the HTML host
document. TextPad includes a Run Java Applet command, which opens the
HTML host document and executes Java's appletviewer.exe command to display
the Applet Viewer window. If you are compiling and running the Java applet
from the command prompt, you type appletviewer, followed by the name of the
host document.
 
Search WWH ::




Custom Search