Java Reference
In-Depth Information
The source code for the applet now is complete. Lines 22 through 25 of
the code declare an Image object and use the getImage() method to retrieve the
Smile.gif image file from disk. The drawImage() method then draws the graphic
in the applet window. Finally, the setBackground() method changes the back-
ground color of the window to cyan.
Saving a Source Code File with a New Name
Once the editing to convert the application to an applet is complete, the file
should be saved with a file name that matches the class name, WelcomeApplet, as
shown in the following steps.
To Save the Source Code File with a New File Name
1. If necessary, insert the Data Disk in drive A. With the TextPad coding
window open, click File on the menu bar and then click Save As on the
Tools menu.
2. Type WelcomeApplet in the File name text box. Do not press the ENTER
key. If necessary, click the Save as type box arrow and then click Java
(*.java) in the list. If necessary, click the Save in box arrow, click 3 1 2
Floppy (A:) in the list, and then double-click the Chapter02 folder.
The file name, WelcomeApplet,
is displayed in the File name
text box (Figure 2-56). Java
(*.java) is displayed in the Save
as type box. Chapter02 is dis-
played in the Save in box.
3. Click the Save button in the
Save As dialog box.
OTHER WAYS
1. Press ALT + F , A
2. Press F 12
Chapter02 is
current folder
Save As
dialog box
new file
name
Save button
FIGURE 2-56
Java (*.java)
file type
 
Search WWH ::




Custom Search