Creating an Applet User Interface |
In the Java Applet package (java.applet), the Applet class and AudioClip interface provide basic support for playing sounds. Currently, the Java API supports only one sound format: 8 bit, µlaw, 8000Hz, one-channel, Sun ".au" files. You can create these on a Sun workstation using the audiotool application. You can convert files from other sound formats using an audio format conversion program.Here are the sound-related Applet methods:
The AudioClip interface defines the following methods:
- getAudioClip(URL), getAudioClip(URL, String)
- Given a URL, these methods return an object that implements the AudioClip interface.
- play(URL), play(URL, String)
- These methods get the AudioClip corresponding to the specified URL and then play it.
- loop()
- Starts playing the clip repeatedly.
- play()
- Plays the clip once.
- stop()
- Stops playing the clip.
Creating an Applet User Interface |