为什么听不到声音?
package javaDaZuoYe;import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
/*
* 添加声音 但是为什么听不到志声音?
*/
public class AudioJApplet extends JApplet implements ActionListener{
AudioClip au;
JButton JBstart=new JButton("Play");
JButton JBpause=new JButton("Pause");
public void init(){
au=getAudioClip(getCodeBase(),"1.mid");
this.setLayout(new FlowLayout());
this.add(JBstart);
this.add(JBpause);
JBstart.addActionListener(this);
JBpause.addActionListener(this);
}
public void actionPerformed(ActionEvent e){
String cmd=e.getActionCommand();
if(cmd.equals("Play")){
au.loop();
}
else if(cmd.equals("Pause")){
au.stop();
}
}
public void stop(){
au.stop();
}
}