Java Reference
In-Depth Information
Figure 14.9
Options for running the appletviewer tool.
To view an applet using appletviewer, you enter the name of any .html file
that embeds the applet. For example, the HelloSwingApplet is embedded in
the colors.html page. Figure 14.10 shows the command line to view this applet
in appletviewer. Note that the first time you run appletviewer a message
appears about using a default properties file. This is perfectly fine.
Figure 14.11 shows the HelloSwingApplet being displayed by the
appletviewer tool.
When you are developing applets, it is common to view them in a Web
browser, change a few things, recompile the applet, and go back and view
your changes in the browser. You will soon find out that refreshing the
Web page in the browser may or may not reload the applet class. I have
noticed this with Internet Explorer using the Java plug-in while I was
writing the applets for this chapter.
The only remedy I found was to close the browser window and start it
back up again so that the applet class was reloaded by the JVM. One nice
benefit of appletviewer is that you can view an applet, make a change to
the code, recompile it, and simply reload the applet by selecting Reload
from the appletviewer menu. After you know that the applet is working
properly, you can try it out in a Web browser such as Internet Explorer or
Netscape Navigator.
Figure 14.10
appletviewer will display any applets embedded in the colors.html file.
Search WWH ::




Custom Search