HTML and CSS Reference
Save the file in the testapplet folder with the file name of java.html. You are not yet
ready to test the page—you need to create and format the text file that the applet
expects. This applet expects each line of text to begin with text= . Figure 11.15
shows a sample text file created using Notepad.
The text file needed
by the fader26 Java
Use this as a guide to create your text file. Save your text file as mymessage.txt in the
testapplet folder. The name of the text file must match the value of the “Data” parameter
in the XHTML code. Now launch your page in a browser. The applet should display
your text one line at a time (Your browser may display a warning message about the
fader26.class applet being created using an earlier version of java—just click OK or
To provide accessibility for all your Web page visitors, regardless of whether their
browser or user-agent can process a Java applet, modify the <applet> tag to use an
alt attribute and include a text description of the Java applet. The code is shown
Focus on Accessibility
<applet code="fader26.class" height="30" width="610"
alt="Java applet: displays a promotional message one line at a time" >
<param name=“AppletHome" value="http://www.crosswinds.net/fader/" />
<param name="Data" value="mymessage.txt" />
<param name="bgColor" value="#FFFFFF" />
This Java applet displays a message one line at a time. Message:
This is a Java applet. This displays text one line at a time.
Why doesn't my Java applet work?
If your applet does not function as expected, verify the following:
● Are Java applets enabled in your browser?
● Is the applet saved in the testapplet folder?
● Is the applet saved with the name fader26.class (all letters must be in lowercase)?
● Are the java.html and mymessage.txt files saved in the testapplet folder?
● Does the code attribute on the <applet> tag have the value of fader26.class?
Be aware that the disadvantage of using Java applets is the lag between the time the Web
page is initially loaded and the time the applet actually begins to execute. Your Web page
visitor will see a box in the area reserved for the applet until it begins executing.