/*Applet 程序需要加载在html文件中才可运行*/
/* AppletDemo.java*/
java.awt.*;
import java.net.URL;
import java.applet.Applet;
import java.applet.AudioClip;
public class AppletDemo extends Applet
{
AudioClip sound;
URL url;
public void init()
{
try{url = new URL("file", "localhost", "d://javawork//11.wma");}catch(Exception e){}
sound = getAudioClip(url);
sound.loop();
}
public void paint(Graphics graph)
{
graph.drawString("music",20,20);
}
public void stop()
{
sound.stop();
}
}
评论