372 Chapter 21 – Interactivity
Java Applets
Web Design in a Nutshell, eMatter Edition
applets available for free or for a licensing fee that you can download from
libraries on the Web.
A good place to start is the applets section of Sun’s Java site athttp://java.sun.com/
applets/. This page provides a list of links to applet-related resources.
If you are looking for cool applets you can use right away, try the JavaBoutique at
http://javaboutique.internet.com/. Here you will find hundreds of applets available
for download as well as clear instructions for their use. It’s a great way to add
interactivity to your site without learning any programming.
In addition to these, there are a number of small businesses with Java applet pack-
ages for sale or available for a nominal licensing fee. Because the list is constantly
changing, I recommend doing a search for “Java Applets” on Yahoo (http://www.
yahoo.com) or your favorite search engine.
Adding an Applet to a Page
It is fairly easy to download an applet and add it to a web page. The steps below
follow the instructions provided by the JavaBoutique for downloading applets
from their site, but they can be used for applets from any resource.
- Download the.classfile along with any associated image or audio files. (Note,
there is a bug in Netscape 4.0 that requires you to hold the Shift key before
clicking the link for the.classfile). In some cases, you may be given the raw
Java code, in which case you would need to compile it using Sun’s Java
Developer Kit. - The.classfile should be saved in the same directory as the HTML file unless
otherwise noted by thecodebaseattribute in the associated - When getting an applet from a library such as JavaBoutique, the required
HTML source is made available with the download, so you can just copy and
paste it into your HTML document and adjust the parameters as necessary.
Applets are generally placed on web pages using the