用mid就可以啊
JAVA是什么?我也不清楚......
我给你看一个吧
import java.applet.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class abc extends Applet implements ActionListener,ItemListener
{
private AudioClip first,second,current;
private JButton play,stop;
private JComboBox choices;
public void init()
{
setBackground(new Color(0,255,0));
setSize(400,50);
setLayout(new FlowLayout());
play=new JButton("play");
stop=new JButton("stop");
String choic[]={"一生有你","爱如潮水"};
choices=new JComboBox(choic);
add(choices);
add(play);
add(stop);
first=getAudioClip(getDocumentBase(),"ys.mid");
second=getAudioClip(getDocumentBase(),"02.mid");
current=first;
choices.addItemListener(this);
play.addActionListener(this);
stop.addActionListener(this);
}
public void itemStateChanged(ItemEvent e)
{
first.stop();
if(choices.getSelectedIndex()==0)
current=first;
else
current=second;
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==play)
{
current.play();
}
if(e.getSource()==stop)
{
current.stop();
}
}
}
这是我先前写过的,只是实现小小的功能而已,你能看懂就行