Java Reference
In-Depth Information
14. Save and compile both your PlayListener class and EnterASongAp-
plet class.
15. Write an HTML page named playclip.html. Add the PlayClipApplet
and EnterASongApplet applets to the page, using two separate
<applet> tags. Assign the name attribute of the PlayClipApplet as
playclip.
16. View the playclip.html page in your Web browser.
You should be able to enter a filename representing an audio clip, play
the clip by clicking the Play button, and stop it by clicking the Stop button.
Lab 14.5: Using JAR Files
The purpose of this lab is to become familiar with creating a JAR file
using the jar tool, and also how to use JAR files with applets. This lab
uses the classes you created in Lab 14.4.
1. Using the jar tool, create a new file called songapplet.jar that con-
tains all the .class files from Lab 14.4. Also include in the JAR any
audio files that the applets will use.
2. Modify the playclip.html file, adding the archive attribute to both
<applet> tags. The value of the archive attributes should be
songapplet.jar.
3. Move the files songapplet.jar and playclip.html into a new directory
by themselves.
4. Open the playclip.html file in a browser to ensure that everything is
still working properly.
The output is the same as your output in Lab 14.4. The difference is
that now all of the necessary files are compressed into a single JAR file,
allowing your applets to be easily deployed and downloaded by clients.
I had you move the files into a new directory to ensure that the JAR file
was working and that the Web page wasn't finding the unarchived class
files from the previous lab.
Search WWH ::




Custom Search