也没有什么错误!就是播放不了!请高手赐教!
public class AudioClips extends Frame implements Runnable, ActionListener ,ItemListener{
Thread thread;
Choice choice;
URL url;
AudioClip audioClips;
File file;
Button play, stop, loop;
String string; AudioClips() {
thread = new Thread(this);
choice = new Choice();
choice.add("flourish.mid");
choice.add("notify.wav");
play = new Button("播放");
stop = new Button("停止");
loop = new Button("循环");
choice.addItemListener( (ItemListener) this);
play.addActionListener(this);
stop.addActionListener(this);
loop.addActionListener((ActionListener) this);
this.setLayout(new FlowLayout());
this.add(choice);
this.add(play);
this.add(stop);
this.add(loop);
this.setSize(200, 300);
this.setVisible(true); this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
} });
this.validate();
} public void itemStateChanged(ItemEvent e) {
string = choice.getSelectedItem();
if (!(thread.isAlive())) {
thread = new Thread(this); }
thread.start();
} public void run() {
file = new File(string);
try {
url = file.toURL();
//System.out.print(url);
audioClips= (AudioClip) Applet.newAudioClip(url);
audioClips.play();
// System.out.println(audioClips);
} catch (Exception e) { System.out.print(e.getMessage());
} } @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == play) {
 // System.out.println("play");
audioClips.play();
} }
 
}