Reputation: 137
I am getting an Expected Identifier error when trying to compile an applet with AudioClip. I plan on adding this to a JFrame, and I was hoping to get the AudioClip to loop.
import java.applet.*;
import java.awt.*;
public class Audio extends Applet
{
AudioClip sound = getAudioClip(getCodeBase(), "myssy.au");
sound.loop();
}//end of Audio Applet
Upvotes: 3
Views: 379
Reputation: 168835
a more efficient way of playing a sound in a JFrame
Use a Clip
- see the example on the Java Sound info. page. It uses a JOptionPane
rather than a JFrame
(to prevent the daemon thread of the Clip
from stopping at the end of main()
), but the principle is the same.
Upvotes: 1