用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();
}
}
}
这是我先前写过的,只是实现小小的功能而已,你能看懂就行
MP3格式JAVA播不了,你改后缀没有用,里面的数据格式并不因为你改后缀就改了,播放器之所以可以播,是因为数据结构没变,它改了后缀后仍然是一个MP3文件
听说mp3也是可以播放的
不过要下在一个什么包,
上课当时没仔细听
也没兴趣去下,毕竟网速不好。
听说mp3也是可以播放的
不过要下在一个什么包,
上课当时没仔细听
也没兴趣去下,毕竟网速不好。
用JAVA标准的API是不可能播放MP3的,你得下JAVA媒体框架(java media framework)才能播放MP3