![]() |
VOOZH | about |
In this article, we will be using the Applet window to play the sound or music. Here, we will have buttons like Play, Pause, and Restart. Using these buttons we will manage the sound in the Applet window.
The folder view of the project is shown in the below image.
Step 1: First, create the file as SoundApplet.java and enter the code into it.
Step 2: Once the code is been inserted then we need to create the AppletImage.html file, through which we will display the output.
Step 3: We need to have the sample sound file which we need to manage from applet. Here, we have the sound.wav file which is present in the code directory.
Step 4: Then we need to compile the Java code using the below command:
javac SoundApplet.javaStep 5: Now finally we need to run the application using the below command:
appletviewer SoundApplet.htmlImplementation of the SoundApplet program is mentioned below: