请问这个程序怎么播放不成音乐呢?
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/**
* @author feifei
*
*/
@SuppressWarnings("serial")
public class AudioDemo extends Applet implements ActionListener{
/**
*
*/
//private static final long serialVersionUID = 7787516386587651803L;
/**
*
*/
//private static final long serialVersionUID = 1L;
/**
*
*/
AudioClip clip;
Button b_play,b_loop,b_stop;
public void init(){
clip=getAudioClip(getDocumentBase(),"40-梅花三弄(笛子).au");
b_play=new Button("Play");
b_play.addActionListener(this);
b_loop=new Button("Loop");
b_loop.addActionListener(this);
b_stop=new Button("Stop");
b_stop.addActionListener(this);
add(b_play);
add(b_loop);
add(b_stop);
}
public void stop(){
if(clip!=null)
clip.stop();
}
public void actionPerformed(ActionEvent e){
if(e.getSource()==b_play)
clip.play();
else if(e.getSource()==b_loop)
clip.loop();
else if(e.getSource()==b_stop)
clip.stop();
}
}
------解决方案--------------------
你的文件放在哪的,你这样写的话应该是放在同一个目录下的
你试着用wav格式的看看