Java Reference
In-Depth Information
The following steps create the HTML file and save it on the Data Disk in
Drive A.
To Create the HTML Host Document
1. With the TextPad window displayed, click File on the menu bar and then
click New.
2. Click File on the menu bar and then click Save As on the File menu.
When the Save As dialog box is displayed, click the Save in box arrow
and then click 3 1 2 Floppy (A:) in the Save in list.
3. Double-click the Chapter04 folder or a location specified by your
instructor.
4. Type CommissionApplet in the File name text box and then click HTML
(*.htm*, *.stm*) in the Save as type list.
5. Click the Save button in the Save As dialog box.
6. In the coding window, type the code as shown in Figure 4-35.
TextPad displays the HTML code (Figure 4-36).
HTML code for
h ost documen t
FIGURE 4-36
coding window
Close button
7. Click the Save button in the TextPad Standard toolbar.
8. Click the coding window Close button.
Coding an Applet Stub
As you may recall from previous chapters, creating an applet typically
involves importing two class packages that Java will need to support the applet-
related methods. First, the java.applet package is imported to lay the foundation
for an applet by allowing the applet to inherit certain attributes and manipulate
classes.
Programmers commonly enter an import statement to import the Abstract
Window Toolkit (AWT), which provides resources that implement rich, attrac-
tive, and useful interfaces in Java applets. As you learned in Chapter 2, the
java.awt package is included with the SDK and contains all of the classes for
 
Search WWH ::




Custom Search