请高手来帮我看一下,不甚感激!
//音乐放映import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.applet.AudioClip;
public class Music extends Applet implements ItemListener
{
AudioClip midi[] = new AudioClip[3];
AudioClip song;
Choice coi = new Choice();
Button butloop = new Button("循环");
Button butstop = new Button("停止");
public void init()
{
String num;
for( int i = 0; i < midi.length; i ++)
{
num = String.valueOf(i + 1) ;
midi[i] = getAudioClip(getCodeBase(),num + ".mid");
}
coi.add("蜀绣");coi.add("青衣");coi.add("西关");
add(coi);
add(butloop);add(butstop);
coi.addItemListener(this);
butloop.addActionListener(new MyActLit());
butstop.addActionListener(new MyActLit());
song = midi[0];
song.play();
}
public void itemStateChanged(ItemEvent e)
{
song.stop();
int i = coi.getSelectedIndex();
song = midi[i];
song.play();
}
class MyActLit implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
Button but = (Button)e.getSource();
if(but == butloop) song.loop();
else song.stop();
}
}
}
请问我把三首歌和这个程序还有相关的.html文件放在同一个文件夹下,能运行,但就是不能放出歌曲,请问这是为什么?
希望哪位高手给指点一下迷津。先谢谢了。