package zhouchuan;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import http://www.doczj.com/doc/14a89d43eef9aef8941ea76e58fafab069dc44b5.html.*;
public class zhouchuan extends Applet implements ActionListener { AudioClip clip;
Button buttonPlay,
buttonLoop,
buttonStop;
public void init(){
try{
URL url=new URL("file:"+"F://ding.wav");
clip=getAudioClip(url);}catch(Exception e){
}
buttonPlay=new Button("开始播放");
buttonLoop=new Button("循环播放");
buttonStop=new Button("停止播放");
buttonPlay.addActionListener(this);
buttonStop.addActionListener(this);
buttonLoop.addActionListener(this);
add(buttonPlay);
add(buttonLoop);
add(buttonStop);
}
public void stop(){
clip.stop();
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==buttonPlay)
clip.play();
else if(e.getSource()==buttonLoop)
clip.loop();