// These are some of the standard "imports" we'll be using, explained in class import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.applet.*; import java.net.*; public class SimpleSongPlayer extends Applet implements ActionListener { JButton button; AudioClip song; String songLocation = "oz_pretty.wmv"; public void init() { // Attempt to load the song try { song = newAudioClip(new URL(getCodeBase(), songLocation)); } catch (MalformedURLException e) { } // Create the button we'll use button = new JButton("Play"); // Add it to the UI setLayout(new BorderLayout()); add("Center", button); // Lastly, we instruct the applet to "listen" for the button to be pressed button.addActionListener(this); } public void actionPerformed(ActionEvent evt) { // play the song song.loop(); } }