师兄写的一个JAVA播放器的源代码(转)
师兄写的一个JAVA播放器的源代码
MediaPlayer.java
----------------------------------------------------------------------------
//程序主文件
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.media.*;
import java.io.*;
import java.util.*;//为了导入Vector
//import com.sun.java.swing.plaf.windows.*;
public class MediaPlayer extends JFrame implements ActionListener,Runnable
{
private JMenuBar bar;//菜单条
private JMenu fileMenu,choiceMenu,aboutMenu;
private JMenuItem openItem,openDirItem,closeItem,about,infor;
private JCheckBoxMenuItem onTop;
private boolean top=false,loop;//设定窗口是否在最前面
private Player player;//Play是个实现Controller的接口
private File file,listFile;//利用File类结合JFileChooser进行文件打开操作,后则与list.ini有关
private Container c;
//private UIManager.LookAndFeelInfo[] look;
private String title,listIniAddress;//标题
private FileDialog fd;
private JPanel panel,panelSouth;
private Icon icon; //开始进入的时候要显示的图标,它为抽象类,不能自己创建
private JLabel label,listB;//用来显示图标
private JList list;//播放清单
private JScrollPane scroll;//使播放清单具有滚动功能
private ListValues listWriteFile;//用于向文件中读取对象
private ObjectInputStream input;//对象输入流
private ObjectOutputStream output;//对象输出流
private JPopupMenu popupMenu;//鼠标右键弹出菜单
private JMenuItem del,delAll,reName; //弹出菜单显示的菜单项,包括删除,全部删除和重命名
private Vector fileName,dirName,numList;
private String files,dir;
private int index;//曲目指针
private Properties prop;//获得系统属性
private int indexForDel;//标志要删除的列表项目的索引
private ButtonGroup buttonGroup;//控制按钮组
private JRadioButtonMenuItem[] buttonValues;
private String[] content={"随机播放","顺序播放","单曲循环"};
private DialogDemo dialog1;
//private JDialogTest dialog2;//用于显示播放清单
MediaPlayer()//构造函数
{
super("java音频播放器1.1版");//窗口标题
c=getContentPane();
c.setLayout(new BorderLayout());
//c.setBackground(new Color(40,40,95));
fileName=new Vector(1);
dirName=new Vector(1);
numList=new Vector(1);//构造三个容器用于支持播放清单
//vectorToString=new String[];
//prop=new Properties(System.getProperties());
//listIniAddress=prop.getProperty("user.dir")+"\\list.ini";
//listFile=new File(listIniAddress);//本来这些代码用来取的系统属性,后来
//发现根本就不用这么麻烦
listFile=new File("list.ini");//直接存于此目录
Thread readToList=new Thread(this);//注意编线程程序的时候要注意运行的时候含有的变量亿定义或者初始化,
//这就要求线程要等上述所说的情况下再运行,否则很容易发生错误或则异常
list=new JList();
list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
list.setSelectionForeground(new Color(0,150,150));
list.setVisibleRowCount(10);
list.setFixedCellHeight(12);
list.setFixedCellWidth(250);
list.setFont(new Font("Serif",Font.PLAIN,12));
list.setBackground(new Color(40,40,95));
list.setForeground(new Color(0,128,255));
//list.setOpaque(false);
list.setToolTipText("点右键显示更多功能");//创建播放清单并设置各个属性
list.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2) //判断是否双击
{
index = list.locationToIndex(e.getPoint());//将鼠标坐标转化成list中的选项指针
createPlayer2();
//System.out.println("Double clicked on Item " + index);,此是测试的时候加的
}
}
/* public void mousePressed(MouseEvent e)
{
checkMenu(e);//自定义函数,判断是否是右键,来决定是否显示菜单
}*/
public void mouseReleased(MouseEvent e)
{
checkMenu(e);//与上面的一样,判断是否鼠标右键
}
}
);
//listB=new JLabel(new ImageIcon("qingdan.gif"),SwingConstants.CENTER);
scroll=new JScrollPane(list);//用于存放播放列表
//dialog2=new JDialogTest(MediaPlayer.this,"播放清单",scroll);
//dialog2.setVisible(true);
readToList.start();//启动先程,加载播放列表
try
{
Thread.sleep(10);
}
catch(InterruptedException e)
{
e.printStackTrace();
}
/*look=UIManager.getInstalledLookAndFeels();
try
{
UIManager.setLookAndFeel(look[2].getClassName());
SwingUtilities.updateComponentTreeUI(this);
}
catch(Exception e)
{
e.printStackTrace();
}*///与下面的代码实现相同的功能,但执行速度要慢,原因:明显转了个大弯
/*try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e)
{
e.printStackTrace();
} *///此段代码使执行速度大大降低
bar=new JMenuBar();
setJMenuBar(bar);//此两行创建菜单栏并放到此窗口程序
//bar.setBackground(new Color(48,91,183));
fileMenu=new JMenu("文件");
bar.add(fileMenu);
choiceMenu=new JMenu("控制");
bar.add(choiceMenu);
aboutMenu=new JMenu("帮助");
bar.add(aboutMenu);
openItem =new JMenuItem("打开文件");
openDirItem =new JMenuItem("打开目录");
closeItem =new JMenuItem("退出程序");
openItem.addActionListener(this);
openDirItem.addActionListener(this);
closeItem.addActionListener(this);
fileMenu.add(openItem);
fileMenu.add(openDirItem);
fileMenu.add(closeItem);
onTop=new JCheckBoxMenuItem("播放时位于最前面",top);
choiceMenu.add(onTop);
onTop.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
if(onTop.isSelected())
top=true;
else top=false;
setAlwaysOnTop(top);
}
}
);
choiceMenu.addSeparator();//加分割符号
buttonGroup=new ButtonGroup();
buttonValues=new JRadioButtonMenuItem[3];
for(int bt=0;bt<3;bt++)
{
buttonValues[bt]=new JRadioButtonMenuItem(content[bt]);
buttonGroup.add(buttonValues[bt]);
choiceMenu.add(buttonValues[bt]);
}
buttonValues[0].setSelected(true);
choiceMenu.addSeparator();
/*loopItem=new JCheckBoxMenuItem("是否循环");
choiceMenu.add(loopItem);
loopItem.addItemListener(new ItemListener()
{
public void itemStateChanged(ItemEvent e)
{
loop=!loop;
}
}
);*/
infor=new JMenuItem("软件简介");
aboutMenu.add(infor);
infor.addActionListener(this);
about=new JMenuItem("关于作者");
about.addActionListener(this);
aboutMenu.add(about);
//菜单栏设置完毕
panel=new JPanel();
panel.setLayout(new BorderLayout());
c.add(panel,BorderLayout.CENTER);
panelSouth=new JPanel();
panelSouth.setLayout(new BorderLayout());
c.add(panelSouth,BorderLayout.SOUTH);
icon=new ImageIcon("icon\\Player.jpg");
label=new JLabel(icon);
panel.add(label);
popupMenu=new JPopupMenu();
del =new JMenuItem("删除");//鼠标右键弹出菜单对象实例化
popupMenu.add(del);
del.addActionListener(this);
delAll =new JMenuItem("全部删除");
popupMenu.add(delAll);
delAll.addActionListener(this);
reName =new JMenuItem("重命名");
popupMenu.add(reName);
reName.addActionListener(this);
scroll=new JScrollPane(list);//用于存放播放列表
listB=new JLabel(new ImageIcon("icon\\qingdan.gif"),SwingConstants.CENTER);
panelSouth.add(listB,BorderLayout.NORTH);
panelSouth.add(scroll,BorderLayout.CENTER);
dialog1=new DialogDemo(MediaPlayer.this,"软件说明");
this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);//设定窗口关闭方式
//this.setTitle("d");编译通过,说明可以再次设定标题
this.setLocation(400,250);//设定窗口出现的位置
//this.setSize(350,320);//窗口大小
setSize(350,330);
this.setResizable(false);//设置播放器不能随便调大小
this.setVisible(true);//此句不可少,否则窗口会不显示
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==openItem)//getSource()判断发生时间的组键
{
//System.out.println("d");测试用
openFile();
//createPlayer();
//setTitle(title);
}
if(e.getSource()==openDirItem)//打开目录
{
openDir();
}
if(e.getSource()==closeItem)//推出播放器
{
exity_n();
//System.exit(0);
}
if(e.getSource()==about)
{
JOptionPane.showMessageDialog(this,"此简易播放器由计科0302\n"
+"harly\n "+" 完成 ",
"参与者",
JOptionPane.INFORMATION_MESSAGE);
}
if(e.getSource()==del)
{
//index
//delPaintList(index);
fileName.removeElementAt(indexForDel);
dirName.removeElementAt(indexForDel);
numList.removeAllElements();//从三个容器里面移除此项
Enumeration enumFile=fileName.elements();
while(enumFile.hasMoreElements())
{
numList.addElement((numList.size()+1)+"."+enumFile.nextElement());
//numList添加元素,显示播放里表中
}
//list.setListData(fileName);
list.setListData(numList);
if(index<indexForDel)
list.setSelectedValue(numList.elementAt(index),true);
else
{
if(index==indexForDel);
else
if(index!=0)
list.setSelectedValue(numList.elementAt(index-1),true);
}
//list.setSelectedIndex(index);
}
if(e.getSource()==delAll)//全部删除
{
fileName.removeAllElements();
dirName.removeAllElements();
numList.removeAllElements();
list.setListData(numList);
}
if(e.getSource()==reName)//重命名
{
String name;//=JOptionPane.showInputDialog(this,"请输入新的名字");
try
{
name=reNames();
fileName.setElementAt(name,indexForDel);
numList.setElementAt((indexForDel+1)+"."+name,indexForDel);
}
catch(ReName e2)//自定义的异常
{
}
}
if(e.getSource()==infor)
{
dialog1.setVisible(true);
}
}
public static void main(String[] args)
{
final MediaPlayer mp=new MediaPlayer();
mp.setIconImage(new ImageIcon("icon\\mPlayer.jpg").getImage());//改变默认图标
mp.addWindowListener(new WindowAdapter()//注册窗口事件
{
public void windowClosing(WindowEvent e)
{
//System.exit(0);
mp.exity_n();
}
}
);
System.out.println("注意:更新文件列表后,请先正常关闭播放器"
+"\n然后再关闭此DOS窗口,否则导致播放列表不能保存!!");
}
private void openFile()//为了界面原因,此代码重写,估计兼容性不好了
{
/*JFileChooser fileChooser=new JFileChooser();//文件选择器
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);//可以选择文件不能目录
int result=fileChooser.showOpenDialog(this);//创建文件打开对话框,并设定此程序为父窗口监控*/
/*通过result的值来判断文件是否打开成功
*JFileChooser类有很多静态成员变量
**/
/*if(result==JFileChooser.CANCEL_OPTION)
{
file=null;//file已经在类中定义,如果选择取消,file指向为空
}
else
{
file=fileChooser.getSelectedFile();//获得文件对象
title=file.getAbsolutePath();//取得文件的绝对路径并且赋给title设定标题
}*/
//if(fd==null)
//{
//String filename="java音频播放器";
fd = new FileDialog(MediaPlayer.this);
//Filters fl=new Filters();
//fd.setFilenameFilter(fl);
fd.setVisible(true);
if (fd.getFile() != null)
{
title = fd.getDirectory() + fd.getFile();//原因请见同目录下的FileDialogDemo.java文件
files=fd.getFile();
//dir =fd.getDirectory();
file=new File(title);
createPlayer();
}
//title=filename;
//fd=null;//缺少此句如果第一次打开文件的时候取消操作的时候第二次也不能打开文件了
//}
}
private void openDir()
{
JFileChooser fileChooser=new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int result=fileChooser.showOpenDialog(MediaPlayer.this);
if(result==JFileChooser.CANCEL_OPTION)
return;
file=fileChooser.getSelectedFile();
if(file==null||file.getName().equals(""))
JOptionPane.showMessageDialog(this,"错误的路径",
"出错了",JOptionPane.ERROR_MESSAGE);
String[] sFiles=file.list();
for(int i=0;i<sFiles.length;i++)
{
fileName.addElement(sFiles[i]);
numList.addElement((numList.size()+1)+"."+sFiles[i]);
dirName.addElement(file.getAbsolutePath()+"\\"+sFiles[i]);
}
list.setListData(numList);
/*fd=new FileDialog(MediaPlayer.this);
fd.setVisible(true);
if(fd.getDirectory()!=null)
{
File fileDir=new File(fd.getDirectory());
String[] ss=fileDir.list();
for(int i=0;i<ss.length;i++)
{
System.out.println(ss[i]);
}
}*/
}
private void createPlayer()
{
closePreviosPlayer();//关闭先前的媒体播放器
String extendName="此播放器好象不支持"+title.substring(title.lastIndexOf(".")+1)+"格式";
try
{
player=Manager.createPlayer(file.toURL());//javax.media.Manager直接继承于java.lang.object,且它为final,不能被继承
player.addControllerListener(new ControllerHand());
player.start();
addList(files);
index=fileName.size()-1;
list.setSelectedValue(numList.elementAt(index),true);
//list.setSelectedIndex(index);
//list.setSelectionForeground(Color.blue);
setTitle(title);
//addList("files");//到播放清单
//title="file.getAbsoluteFile()";
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,extendName,"出错了!!",JOptionPane.ERROR_MESSAGE);
setTitle(extendName);
}
}
private void closePreviosPlayer()
{
if(player==null)
return;
//player.close();//首先停止播放
/*
*不能用上面的代码停止,要用下面的两行取代,否则Component visual =player.getVisualComponent();发生异常
**/
player.stop();
player.deallocate(); //停止播放并且重新装载DateSource
Component visual =player.getVisualComponent();
Component control=player.getControlPanelComponent();
if(visual!=null)
{
panel.remove(visual);
}
if(control!=null)
{
panel.remove(control);
}
}
private class ControllerHand implements ControllerListener
{
public void controllerUpdate(ControllerEvent e)
{
if(e instanceof RealizeCompleteEvent)
{
Component visual=player.getVisualComponent();
if(visual!=null)
{
//System.out.println("音频播放器不支持视频图象功能");
//setTitle("音频播放器不支持视频图象功能");
panel.removeAll();
panel.add(visual,BorderLayout.CENTER);
}
else
{
panel.add(label,BorderLayout.CENTER);
}///此else语句可以防止因为原来播放视频图象后以后没有界面
Component control=player.getControlPanelComponent();
if(control!=null)
{
panel.add(control,BorderLayout.SOUTH);
}
//c.validate();
panel.doLayout();
return;
}
if (e instanceof EndOfMediaEvent)
{
/*if (loop)
{
player.setMediaTime (new Time (0));
player.start ();
}
return;*/
if(buttonValues[0].isSelected())
{
if(fileName.size()==0)
return;
index=(int)(Math.random()*fileName.size());
}
if(buttonValues[1].isSelected())
{
if(fileName.size()==0)
return;//必须有此if语句,否则当用户把播放列表清空的时候发生异常,偶然的机会发现的
//现在感觉测试软件真是太重要了,看来以后程序做好后要反复测试,考虑各种情况
index=(index+1)%fileName.size();
}
if(buttonValues[2].isSelected())
{
player.setMediaTime (new Time (0));
player.start();
}
createPlayer2();
}
}
}
private void exity_n()
{
/*int exi;
exi=JOptionPane.showConfirmDialog(this,"真的要离开么?","退出程序",JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
//if(exi==null)
if(exi==JOptionPane.YES_OPTION)
{
saveList();
System.exit(0);
}
return;*/
saveList();
System.exit(0);
}
private void addList(String vf)
{
//fileReadList=new fileReadList(fdd,)
//try
//{
//int i=0;
//fileName.addElement((fileName.size()+1)+"."+vf);
fileName.addElement(vf);
numList.addElement((numList.size()+1)+"."+vf);
//fileName.addElement(++i+"."+vf);
dirName.addElement(title);
list.setListData(numList);
//}
/*catch(Exception e)
{
e.printStackTrace();
//System.out.println(e.getMessage());
}*/
}
private void createPlayer2()
{
try{title=dirName.elementAt(index).toString();}
//title=dirName.elementAt(index).toString();
catch(ArrayIndexOutOfBoundsException e)
{return;}
file=new File(title);
closePreviosPlayer();//关闭先前的媒体播放器
String extendName="此播放器好象不支持"+title.substring(title.lastIndexOf(".")+1)+"格式";
try
{
player=Manager.createPlayer(file.toURL());//javax.media.Manager直接继承于java.lang.object,且它为final,不能被继承
player.addControllerListener(new ControllerHand());
player.start();
//list.setSelectedIndex(index);
list.setSelectedValue(numList.elementAt(index),true);
//list.setSelectionForeground(Color.blue);
//list.setSelectedIndex(index);
//addList(files);
setTitle(title);
//addList("files");//到播放清单
}
catch(Exception e)
{
//JOptionPane.showMessageDialog(this,extendName,"出错了!!",JOptionPane.ERROR_MESSAGE);
//setTitle(extendName);
String ex=null;
try{ex=fileName.elementAt(index).toString();
}
catch(Exception e1){return;}
fileName.removeElementAt(index);
numList.removeAllElements();
Enumeration enumFile=fileName.elements();
while(enumFile.hasMoreElements())
{
numList.addElement((numList.size()+1)+"."+enumFile.nextElement());
}
dirName.removeElementAt(index);
//list.setListData(fileName);
list.setListData(numList);
System.out.println("已经从播放列表中删除 "+"\""+ex+"\""+" 文件,"
+"因为此播放器不支持"+ex.substring(ex.lastIndexOf(".")+1)+"格式,"
+"不过没有从硬盘真正删除");
if(numList.size()!=0)
{
index%=numList.size();
createPlayer2();
}
}
}
private void saveList()
{
Enumeration enumFile=fileName.elements();
Enumeration enumDir =dirName.elements();
try
{
output=new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(listFile)));
while(enumFile.hasMoreElements())
{
listWriteFile=new ListValues(enumFile.nextElement().toString(),enumDir.nextElement().toString());
output.writeObject(listWriteFile);
}
output.flush();
output.close();
}
catch(Exception e)
{
e.printStackTrace();
}
/*finally
{
output.flush();
output.close();//郁闷,这两行不能写在这里,实在是一大遗憾啊,不知道有什么别的方法
}*/
}
public void run()
{
try
{
Thread.sleep(1);
}
catch(InterruptedException e)
{
}
try
{
if(!listFile.exists())
{
listFile.createNewFile();//防止不存在此文件发生读取错误,这两行代码保证不存在的情况下自动建立
return;
}
input=new ObjectInputStream(new BufferedInputStream(new FileInputStream(listFile)));
while(true)
{
listWriteFile=(ListValues)input.readObject();
fileName.addElement(listWriteFile.getFileName());
numList.addElement((numList.size()+1)+"."+listWriteFile.getFileName());
dirName.addElement(listWriteFile.getDirName());
}
}
catch(EOFException e)
{
try
{
//if(!fileName.isEmpty())
input.close();//确认有元素存在并加载完毕后关闭输入流
}
catch(IOException e1)
{
JOptionPane.showMessageDialog(MediaPlayer.this,"文件被非正常关闭",
"非法关闭",JOptionPane.ERROR_MESSAGE);
}
}
catch(ClassNotFoundException e)
{
JOptionPane.showMessageDialog(MediaPlayer.this,"不能创建对象","对象创建失败",JOptionPane.ERROR_MESSAGE);
}
catch(IOException e)
{
JOptionPane.showMessageDialog(MediaPlayer.this,"不能读取文件",
"读取文件失败",JOptionPane.ERROR_MESSAGE);
}
finally
{
try
{
if(input!=null)
input.close();
}
catch(IOException e)
{
}
if(dirName.isEmpty())//防止Vector越界
{
return;
}
index=(int)(Math.random()*(fileName.size()));//产生随即数,进行随即播放
list.setListData(numList);
//list.setListData(fileName);
//list.setSelectedValue(fileName.elementAt(index),true);
//list.ensureIndexIsVisible(index);//确保选择项可以看见
//list.setSelectionForeground(Color.green);
createPlayer2();
}
}
private void checkMenu(MouseEvent e)
{
if(e.isPopupTrigger())
{
indexForDel=list.locationToIndex(e.getPoint());
int[] selected={index,indexForDel};
//Point p=new Point(e.getX(),e.getY());
list.setSelectedIndices(selected);
popupMenu.show(list,e.getX(),e.getY());
}
//list.setSelectedIndex(index);
}
String reNames() throws ReName//文件该名函数
{
String name=JOptionPane.showInputDialog(this,"请输入新的名字",fileName.elementAt(indexForDel));
if(name==null||name.equals("")) throw new ReName();
//必须把name==null放在前面,否则会发生NullPointerExceptin,这个很好理解,
//当我们按了取消后,name会成为空,那么name.equals("")就会发生异常
return name;
}
class ReName extends Exception//自定义异常来处理文件该名的时候发生输入为空的情形
{
}
/*class Filters implements FilenameFilter
{
public boolean accept(File dir,String name)
{
return (name.endsWith(".exe"));
}
}*/
}
posted on 2006-02-19 00:32 samuel's blog 阅读(22484) 评论(43) 编辑 收藏
</div><a name="!comments"></a><div id="blog-comments-placeholder"><div id="comments_pager_top"></div>
<h4><a href="#333318" class="layer">#2楼</a><a name="333318" id="comment_anchor_333318"></a>[<span class="louzhu">楼主</span>]<span> <span class="comment_date">2006-02-19 00:34</span></span><a id="a_comment_author_333318" href="http://www.cnblogs.com/maxun/" target="_blank">samuel's blog</a> <a href="http://msg.cnblogs.com/send/samuel%27s%20blog" title="发送站内短消息" class="sendMsg2This"> </a></h4>
<p></p><div id="comment_body_333318" class="blog_comment_body">ListValues.java
------------------------------------------------------------------------------
//列表文件要用的对象
import java.io.Serializable;
class ListValues implements Serializable
{
private String fileName;
private String dirFileName;
ListValues()
{
setFileName("歌曲名字");
setDirFileName("E:\歌曲名字");
}
ListValues(String fileNameC,String dirFileNameC)
{
setFileName(fileNameC);
setDirFileName(dirFileNameC);
}
void setFileName(String fileNameC)
{
fileName=fileNameC;
}
void setDirFileName(String dirFileNameC)
{
dirFileName=dirFileNameC;
}
String getFileName()
{
return fileName;
}
String getDirName()
{
return dirFileName;
}
}
<h4><a href="#405705" class="layer">#3楼</a><a name="405705" id="comment_anchor_405705"></a><span> <span class="comment_date">2006-05-21 17:14</span></span><a id="ctl00_CommentList_NameLink_2" title="未注册用户" target="_blank">df</a></h4>
<p></p><div id="comment_body_405705" class="blog_comment_body">这个源代码怎么不能用呀,</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(405705,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(405705,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#405706" class="layer">#4楼</a><a name="405706" id="comment_anchor_405706"></a><span> <span class="comment_date">2006-05-21 17:15</span></span><a id="ctl00_CommentList_NameLink_3" title="未注册用户" target="_blank">df</a></h4>
<p></p><div id="comment_body_405706" class="blog_comment_body">这个源代码怎么不能用呀,</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(405706,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(405706,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#408372" class="layer">#5楼</a><a name="408372" id="comment_anchor_408372"></a><span> <span class="comment_date">2006-05-24 21:38</span></span><a id="ctl00_CommentList_NameLink_4" title="未注册用户" target="_blank">mx</a></h4>
<p></p><div id="comment_body_408372" class="blog_comment_body">可以用啊?你是不是整错了哦?</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(408372,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(408372,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#572592" class="layer">#6楼</a><a name="572592" id="comment_anchor_572592"></a><span> <span class="comment_date">2006-11-26 00:41</span></span><a id="ctl00_CommentList_NameLink_5" title="未注册用户" target="_blank">ll[匿名]</a></h4>
<p></p><div id="comment_body_572592" class="blog_comment_body">把JMF安装上</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(572592,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(572592,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#591211" class="layer">#7楼</a><a name="591211" id="comment_anchor_591211"></a><span> <span class="comment_date">2006-12-13 17:10</span></span><a id="ctl00_CommentList_NameLink_6" title="未注册用户" target="_blank">betty[匿名]</a></h4>
<p></p><div id="comment_body_591211" class="blog_comment_body">非常感谢你!</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(591211,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(591211,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#592173" class="layer">#8楼</a><a name="592173" id="comment_anchor_592173"></a><span> <span class="comment_date">2006-12-14 15:17</span></span><a id="ctl00_CommentList_NameLink_7" title="未注册用户" target="_blank">的 </a></h4>
<p></p><div id="comment_body_592173" class="blog_comment_body">太长了有没比叫短的啊
<h4><a href="#695100" class="layer">#9楼</a><a name="695100" id="comment_anchor_695100"></a><span> <span class="comment_date">2007-03-31 15:48</span></span><a id="ctl00_CommentList_NameLink_8" title="未注册用户" target="_blank">369945969</a></h4>
<p></p><div id="comment_body_695100" class="blog_comment_body"> private Player 错误
<h4><a href="#719896" class="layer">#10楼</a><a name="719896" id="comment_anchor_719896"></a><span> <span class="comment_date">2007-04-19 17:18</span></span><a id="ctl00_CommentList_NameLink_9" title="未注册用户" target="_blank">eecomes</a></h4>
<p></p><div id="comment_body_719896" class="blog_comment_body"> 我将上面的eclipse环境里,发现一下几句有问题:
(1) import javax.media.;
(2) private Player player;//Play是个实现Controller的接口
(3) player=Manager.createPlayer(file.toURL())
(4) private class ControllerHand implements ControllerListener
(5) if(e instanceof RealizeCompleteEvent)
(6) if (e instanceof EndOfMediaEvent)
对于第(1)句:显示找不到media.
对于第(2)句:显示Player can not be resolved to a type
对于第(3)句:Multiple markers at this line
-the method toURL()from the type File is deprecated
-player cannot be resolved
-Manager cannot be resolved
对于第(4)句:Contronller cannot be resolved to a type
对于第(5)句:RealizeCompleteEvent cannot be resolved to a type
对于第(6)句:EndOfMediaEvent cannot be resolved to a type
谁能告诉我怎回事吗
<h4><a href="#720039" class="layer">#11楼</a><a name="720039" id="comment_anchor_720039"></a><span> <span class="comment_date">2007-04-19 19:33</span></span><a id="ctl00_CommentList_NameLink_10" title="未注册用户" target="_blank">eecomes</a></h4>
<p></p><div id="comment_body_720039" class="blog_comment_body">哦,我知道了,是缺少一个jmf包,需要到<a target="_new" href="http://java.sun.com/products/java-media/jmf/index.jsp">http://java.sun.com/products/java-media/jmf/index.jsp</a>
下载到这个包,并把它安装起来,就可以了。(程序全部正确)
<h4><a href="#744110" class="layer">#12楼</a><a name="744110" id="comment_anchor_744110"></a><span> <span class="comment_date">2007-05-12 17:44</span></span><a id="ctl00_CommentList_NameLink_11" title="未注册用户" target="_blank">lxhfyly</a></h4>
<p></p><div id="comment_body_744110" class="blog_comment_body">怎么我拿去运行得起,但就是播放不起,只有界面</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(744110,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(744110,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#745739" class="layer">#13楼</a><a name="745739" id="comment_anchor_745739"></a><span> <span class="comment_date">2007-05-14 13:55</span></span><a id="ctl00_CommentList_NameLink_12" title="未注册用户" target="_blank">lxhfyly</a></h4>
<p></p><div id="comment_body_745739" class="blog_comment_body">我用Eclipse运行编译通过就是运行不行,总是报下面的错,不知道怎么回事,能否帮我解答下啊,Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 16000.0 frame rate, FrameSize=32768 bits
Failed to realize: com.sun.media.PlaybackEngine@b23210
Error: Unable to realize com.sun.media.PlaybackEngine@b23210
javax.media.NotRealizedError: Cannot get visual component on an unrealized player
at com.sun.media.BasicPlayer.getVisualComponent(BasicPlayer.java:491)
at com.sun.media.MediaPlayer.getVisualComponent(MediaPlayer.java:48)
at cn.edu.cqnu.MediaPlayer.closePreviosPlayer(MediaPlayer.java:488)
at cn.edu.cqnu.MediaPlayer.createPlayer2(MediaPlayer.java:615)
at cn.edu.cqnu.MediaPlayer$1.mouseClicked(MediaPlayer.java:102)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
at java.awt.Component.processMouseEvent(Component.java:5491)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Exception in thread "AWT-EventQueue-0" javax.media.NotRealizedError: Cannot get visual component on an unrealized player
at com.sun.media.BasicPlayer.getVisualComponent(BasicPlayer.java:491)
at com.sun.media.MediaPlayer.getVisualComponent(MediaPlayer.java:48)
at cn.edu.cqnu.MediaPlayer.closePreviosPlayer(MediaPlayer.java:488)
at cn.edu.cqnu.MediaPlayer.createPlayer2(MediaPlayer.java:615)
at cn.edu.cqnu.MediaPlayer$1.mouseClicked(MediaPlayer.java:102)
at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:212)
at java.awt.Component.processMouseEvent(Component.java:5491)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
<h4><a href="#757712" class="layer">#14楼</a><a name="757712" id="comment_anchor_757712"></a><span> <span class="comment_date">2007-05-23 22:00</span></span><a id="ctl00_CommentList_NameLink_13" title="未注册用户" target="_blank">莫名</a></h4>
<p></p><div id="comment_body_757712" class="blog_comment_body">好,很不错,我再将上面的界面改改,嘿嘿!</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(757712,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(757712,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#785440" class="layer">#15楼</a><a name="785440" id="comment_anchor_785440"></a><span> <span class="comment_date">2007-06-16 09:13</span></span><a id="ctl00_CommentList_NameLink_14" title="未注册用户" target="_blank">jishizaijian</a></h4>
<p></p><div id="comment_body_785440" class="blog_comment_body">C:\java.java:4: package javax.media does not exist
import javax.media.*;
^
C:\java.java:16: cannot find symbol
symbol : class Player
location: class MediaPlayer
private Player player;//Play是个实现Controller的接口
^
C:\java.java:28: cannot find symbol
symbol : class ListValues
location: class MediaPlayer
private ListValues listWriteFile;//用于向文件中读取对象
^
C:\java.java:44: cannot find symbol
symbol : class DialogDemo
location: class MediaPlayer
private DialogDemo dialog1;
^
C:\java.java:488: cannot find symbol
symbol : class ControllerListener
location: class MediaPlayer
private class ControllerHand implements ControllerListener
^
C:\java.java:490: cannot find symbol
symbol : class ControllerEvent
location: class MediaPlayer.ControllerHand
public void controllerUpdate(ControllerEvent e)
^
C:\java.java:245: cannot find symbol
symbol : class DialogDemo
location: class MediaPlayer
dialog1=new DialogDemo(MediaPlayer.this,"软件说明");
^
C:\java.java:437: cannot find symbol
symbol : variable Manager
location: class MediaPlayer
player=Manager.createPlayer(file.toURL());//javax.media.Manager直接继承于java.lang.object,且它为final,不能被继承
^
C:\java.java:492: cannot find symbol
symbol : class RealizeCompleteEvent
location: class MediaPlayer.ControllerHand
if(e instanceof RealizeCompleteEvent)
^
C:\java.java:524: cannot find symbol
symbol : class EndOfMediaEvent
location: class MediaPlayer.ControllerHand
if (e instanceof EndOfMediaEvent)
^
C:\java.java:547: cannot find symbol
symbol : class Time
location: class MediaPlayer.ControllerHand
player.setMediaTime (new Time (0));
^
C:\java.java:605: cannot find symbol
symbol : variable Manager
location: class MediaPlayer
player=Manager.createPlayer(file.toURL());//javax.media.Manager直接继承于java.lang.object,且它为final,不能被继承
^
C:\java.java:661: cannot find symbol
symbol : class ListValues
location: class MediaPlayer
listWriteFile=new ListValues(enumFile.nextElement().toString(),enumDir.nextElement().toString());
^
C:\java.java:701: cannot find symbol
symbol : class ListValues
location: class MediaPlayer
listWriteFile=(ListValues)input.readObject();
^
Note: C:\java.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
14 errors
能帮我改一下吗?
<h4><a href="#882831" class="layer">#16楼</a><a name="882831" id="comment_anchor_882831"></a><span> <span class="comment_date">2007-09-05 13:45</span></span><a id="ctl00_CommentList_NameLink_15" title="未注册用户" target="_blank">欲竖邻疯</a></h4>
<p></p><div id="comment_body_882831" class="blog_comment_body">需要下载JMF API包。
<h4><a href="#996058" class="layer">#17楼</a><a name="996058" id="comment_anchor_996058"></a><span> <span class="comment_date">2007-12-15 16:32</span></span><a id="ctl00_CommentList_NameLink_16" title="未注册用户" target="_blank">sszy</a></h4>
<p></p><div id="comment_body_996058" class="blog_comment_body">请问大家有谁把这个程序运行出来的``麻烦各位能不能把调好了的程序发一遍给我```感激不尽``我 QQ 312619570</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(996058,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(996058,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1026770" class="layer">#18楼</a><a name="1026770" id="comment_anchor_1026770"></a><span> <span class="comment_date">2008-01-05 10:35</span></span><a id="ctl00_CommentList_NameLink_17" title="未注册用户" target="_blank">liutb</a></h4>
<p></p><div id="comment_body_1026770" class="blog_comment_body">太感谢这样的师兄了,,,,,,,
我将那三个类合起来,可以直接播放。。。。
<h4><a href="#1047063" class="layer">#19楼</a><a name="1047063" id="comment_anchor_1047063"></a><span> <span class="comment_date">2008-01-21 12:34</span></span><a id="ctl00_CommentList_NameLink_18" title="未注册用户" target="_blank">蓦然回首</a></h4>
<p></p><div id="comment_body_1047063" class="blog_comment_body">output.flush();
output.close();//郁闷,这两行不能写在这里,实在是一大遗憾啊,不知道有什么别的方法
改为:
try{output.flush();
output.close();
}catch(IOException e){
}
因为这两句会抛出IOException 必须处理
<h4><a href="#1052618" class="layer">#20楼</a><a name="1052618" id="comment_anchor_1052618"></a><span> <span class="comment_date">2008-01-25 10:21</span></span><a id="ctl00_CommentList_NameLink_19" title="未注册用户" href="http://www.cnitblog.com/r.aspx?url=http://怎么不行" rel="nofllow" target="_blank">132</a></h4>
<p></p><div id="comment_body_1052618" class="blog_comment_body">我用的 怎么也是有问题 呀
那 个jmf包也下了
<h4><a href="#1052655" class="layer">#21楼</a><a name="1052655" id="comment_anchor_1052655"></a><span> <span class="comment_date">2008-01-25 10:31</span></span><a id="ctl00_CommentList_NameLink_20" title="未注册用户" href="http://www.cnitblog.com/r.aspx?url=http://怎么不行" rel="nofllow" target="_blank">xiexienidedaima</a></h4>
<p></p><div id="comment_body_1052655" class="blog_comment_body">麻烦大家
能不能把 调好的 程序给我发以下
我的 邮箱
citybeijing2008@163.com
<h4><a href="#1155512" class="layer">#22楼</a><a name="1155512" id="comment_anchor_1155512"></a><span> <span class="comment_date">2008-04-16 10:12</span></span><a id="ctl00_CommentList_NameLink_21" title="未注册用户" href="http://www.cnitblog.com/r.aspx?url=http://ww" rel="nofllow" target="_blank">ffgfgfg</a></h4>
<p></p><div id="comment_body_1155512" class="blog_comment_body">太强了</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1155512,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1155512,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1173813" class="layer">#23楼</a><a name="1173813" id="comment_anchor_1173813"></a><span> <span class="comment_date">2008-04-28 08:14</span></span><a id="ctl00_CommentList_NameLink_22" title="未注册用户" target="_blank">visioniceman</a></h4>
<p></p><div id="comment_body_1173813" class="blog_comment_body">太感谢了。能用了</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1173813,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1173813,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1213063" class="layer">#24楼</a><a name="1213063" id="comment_anchor_1213063"></a><span> <span class="comment_date">2008-05-29 19:36</span></span><a id="ctl00_CommentList_NameLink_23" title="未注册用户" target="_blank">麦峰升</a></h4>
<p></p><div id="comment_body_1213063" class="blog_comment_body">能不能把 调好的 程序给我发以下
我的 邮箱
mai.fengsheng@163.com
谢谢了
<h4><a href="#1213067" class="layer">#25楼</a><a name="1213067" id="comment_anchor_1213067"></a><span> <span class="comment_date">2008-05-29 19:38</span></span><a id="ctl00_CommentList_NameLink_24" title="未注册用户" target="_blank">麦峰升</a></h4>
<p></p><div id="comment_body_1213067" class="blog_comment_body">在其他地方下的JMF也可以用吗?
<h4><a href="#1309087" class="layer">#26楼</a><a name="1309087" id="comment_anchor_1309087"></a><span> <span class="comment_date">2008-09-05 10:47</span></span><a id="ctl00_CommentList_NameLink_25" title="未注册用户" target="_blank">EggKiller</a></h4>
<p></p><div id="comment_body_1309087" class="blog_comment_body">调试成功,正在学习java,收藏了,谢谢!</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1309087,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1309087,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1334082" class="layer">#27楼</a><a name="1334082" id="comment_anchor_1334082"></a><span> <span class="comment_date">2008-10-07 20:36</span></span><a id="ctl00_CommentList_NameLink_26" title="未注册用户" target="_blank">javalover</a></h4>
<p></p><div id="comment_body_1334082" class="blog_comment_body">好像能播放mp3格式的文件</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1334082,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1334082,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1364659" class="layer">#28楼</a><a name="1364659" id="comment_anchor_1364659"></a><span> <span class="comment_date">2008-11-08 13:39</span></span><a id="ctl00_CommentList_NameLink_27" title="未注册用户" target="_blank">bart</a></h4>
<p></p><div id="comment_body_1364659" class="blog_comment_body"> Cannot get visual component on an unrealized player</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1364659,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1364659,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1381577" class="layer">#29楼</a><a name="1381577" id="comment_anchor_1381577"></a><span> <span class="comment_date">2008-11-25 17:00</span></span><a id="ctl00_CommentList_NameLink_28" title="未注册用户" href="http://www.cnitblog.com/r.aspx?url=http://sss" rel="nofllow" target="_blank">fff</a></h4>
<p></p><div id="comment_body_1381577" class="blog_comment_body">很多错误啊</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1381577,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1381577,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1382549" class="layer">#30楼</a><a name="1382549" id="comment_anchor_1382549"></a><span> <span class="comment_date">2008-11-26 14:14</span></span><a id="ctl00_CommentList_NameLink_29" title="未注册用户" target="_blank">muzixinly</a></h4>
<p></p><div id="comment_body_1382549" class="blog_comment_body"> 我的也有好多错误啊 有谁调好的 请也给我发一份
我的邮箱:muzixinly@163.com
谢谢啊 !!!
<h4><a href="#1383673" class="layer">#31楼</a><a name="1383673" id="comment_anchor_1383673"></a><span> <span class="comment_date">2008-11-27 11:56</span></span><a id="ctl00_CommentList_NameLink_30" title="未注册用户" target="_blank">lianghongwei</a></h4>
<p></p><div id="comment_body_1383673" class="blog_comment_body">能把调好的发一份给我吗?感谢!
我的邮箱:lhwzht@yahoo.com.cn
<h4><a href="#1398112" class="layer">#32楼</a><a name="1398112" id="comment_anchor_1398112"></a><span> <span class="comment_date">2008-12-11 12:50</span></span><a id="ctl00_CommentList_NameLink_31" title="未注册用户" href="http://www.cnitblog.com/r.aspx?url=http://好象不能播放啊 就是一个界面" rel="nofllow" target="_blank">SDFF</a></h4>
<p></p><div id="comment_body_1398112" class="blog_comment_body">我把上面那些代码全部搞好没有错误就是不能播放啊 我也下载了Jmf就是不能播放 ,总出现界面. 有谁能把调好的发我下撒 谢谢</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1398112,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1398112,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1424217" class="layer">#33楼</a><a name="1424217" id="comment_anchor_1424217"></a><span> <span class="comment_date">2009-01-07 11:08</span></span><a id="ctl00_CommentList_NameLink_32" title="未注册用户" target="_blank">tigerBIAO</a></h4>
<p></p><div id="comment_body_1424217" class="blog_comment_body">哪些注释用不用去掉?</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1424217,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1424217,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1429222" class="layer">#34楼</a><a name="1429222" id="comment_anchor_1429222"></a><span> <span class="comment_date">2009-01-12 21:10</span></span><a id="ctl00_CommentList_NameLink_33" title="未注册用户" target="_blank">blueglas</a></h4>
<p></p><div id="comment_body_1429222" class="blog_comment_body">能把调好的发一份给我吗?感谢!
blueglas@tom.com
<h4><a href="#1474572" class="layer">#35楼</a><a name="1474572" id="comment_anchor_1474572"></a><span> <span class="comment_date">2009-03-12 08:54</span></span><a id="ctl00_CommentList_NameLink_34" title="未注册用户" target="_blank">hanandy</a></h4>
<p></p><div id="comment_body_1474572" class="blog_comment_body">给我也发一份吧,谢谢!!!!!!!</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1474572,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1474572,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#1474574" class="layer">#36楼</a><a name="1474574" id="comment_anchor_1474574"></a><span> <span class="comment_date">2009-03-12 08:55</span></span><a id="ctl00_CommentList_NameLink_35" title="未注册用户" target="_blank">hanandy</a></h4>
<p></p><div id="comment_body_1474574" class="blog_comment_body">忘记写邮箱了
jefferhan@163.com
非常感谢!!!
<h4><a href="#1613119" class="layer">#37楼</a><a name="1613119" id="comment_anchor_1613119"></a><span> <span class="comment_date">2009-08-12 22:32</span></span><a id="ctl00_CommentList_NameLink_36" title="未注册用户" target="_blank">cainwise</a></h4>
<p></p><div id="comment_body_1613119" class="blog_comment_body">能不能把可以播放的发到我的邮箱哈</div><span class="comment_actions"></span><p></p>
<h4><a href="#1613121" class="layer">#38楼</a><a name="1613121" id="comment_anchor_1613121"></a><span> <span class="comment_date">2009-08-12 22:33</span></span><a id="ctl00_CommentList_NameLink_37" title="未注册用户" target="_blank">cainwise</a></h4>
<p></p><div id="comment_body_1613121" class="blog_comment_body">我的邮箱是cainwises@gmail.com</div><span class="comment_actions"></span><p></p>
<h4><a href="#1653250" class="layer">#39楼</a><a name="1653250" id="comment_anchor_1653250"></a><span> <span class="comment_date">2009-09-21 11:36</span></span><a id="ctl00_CommentList_NameLink_38" title="未注册用户" target="_blank">gjj</a></h4>
<p></p><div id="comment_body_1653250" class="blog_comment_body">能不能把调整好的代码发我邮箱 谢谢了 邮箱是:261902287@qq.com</div><span class="comment_actions"></span><p></p>
<h4><a href="#1966690" class="layer">#40楼</a><a name="1966690" id="comment_anchor_1966690"></a><span> <span class="comment_date">2010-11-23 00:31</span></span><a id="a_comment_author_1966690" href="http://home.cnblogs.com/u/209487/" target="_blank">气死你</a> <a href="http://msg.cnblogs.com/send/%E6%B0%94%E6%AD%BB%E4%BD%A0" title="发送站内短消息" class="sendMsg2This"> </a></h4>
<p></p><div id="comment_body_1966690" class="blog_comment_body">能不能把调整好的代码发我邮箱 谢谢了 邮箱是:649212857@qq.com  </div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(1966690,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(1966690,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#2095325" class="layer">#41楼</a><a name="2095325" id="comment_anchor_2095325"></a><span> <span class="comment_date">2011-05-13 00:20</span></span><a id="a_comment_author_2095325" href="http://home.cnblogs.com/u/299947/" target="_blank">xiaolid</a> <a href="http://msg.cnblogs.com/send/xiaolid" title="发送站内短消息" class="sendMsg2This"> </a></h4>
<p></p><div id="comment_body_2095325" class="blog_comment_body">没有错误,可以运行,但是当打开文件播放的时候出现了以下错误Failed to configure: com.sun.media.PlaybackEngine@1546e25<br> Bad header in the media: WAVE Parser: expected magic string RIFF, got ID3<br><br>Error: Unable to realize com.sun.media.PlaybackEngine@1546e25<br>javax.media.NotRealizedError: Cannot get visual component on an unrealized player<br> at com.sun.media.BasicPlayer.getVisualComponent(BasicPlayer.java:491)<br> at com.sun.media.MediaPlayer.getVisualComponent(MediaPlayer.java:48)<br> at com.cmu.ui.MediaPlayer.closePreviosPlayer(MediaPlayer.java:481)<br> at com.cmu.ui.MediaPlayer.createPlayer(MediaPlayer.java:440)<br> at com.cmu.ui.MediaPlayer.openFile(MediaPlayer.java:397)<br> at com.cmu.ui.MediaPlayer.actionPerformed(MediaPlayer.java:270)<br> at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)<br> at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)<br> at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)<br> at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)<br> at javax.swing.AbstractButton.doClick(AbstractButton.java:357)<br> at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1220)<br> 有没有人有调试好的,请发到我邮箱:1406681203@qq.com<br>非常感谢</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2095325,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2095325,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#2385902" class="layer">#42楼</a><a name="2385902" id="comment_anchor_2385902"></a><span> <span class="comment_date">2012-05-25 17:47</span></span><a id="a_comment_author_2385902" href="http://home.cnblogs.com/u/412739/" target="_blank">2365</a> <a href="http://msg.cnblogs.com/send/2365" title="发送站内短消息" class="sendMsg2This"> </a></h4>
<p></p><div id="comment_body_2385902" class="blog_comment_body">求代码<br>制作一个音频文件播放器,能够播放多种音频格式的文件。<br>功能<br>(1) 实现为Applet小程序<br>(2) 实现开始、暂停、停止等播放控制<br>(3) 维护一个或多个播放列表<br>(4) 能够从Internet下载歌曲并播放</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2385902,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2385902,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
<h4><a href="#2385903" class="layer">#43楼</a><a name="2385903" id="comment_anchor_2385903"></a><span id="comment-maxId" style="display:none;">2385903</span><span id="comment-maxDate" style="display:none;">2012/5/25 17:48:26</span><span> <span class="comment_date">2012-05-25 17:48</span></span><a id="a_comment_author_2385903" href="http://home.cnblogs.com/u/412739/" target="_blank">2365</a> <a href="http://msg.cnblogs.com/send/2365" title="发送站内短消息" class="sendMsg2This"> </a></h4>
<p></p><div id="comment_body_2385903" class="blog_comment_body">如果师兄帮忙写的话,麻烦发到593443911@qq.com</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2385903,'Digg',this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2385903,'Bury',this)">反对(0)</a></div><span class="comment_actions"></span><p></p>
补充:需要下载JMF API包。
评论
-----------------------------------------------------------------------
//软件简介框
import java.awt.;
import java.awt.event.;
import javax.swing.*;
class DialogDemo extends JDialog
{
JTextArea field;
Container c;
String sValue= "\n本软件基于java media framework构建,同时我们"
+"\n正处于基础java学习阶段,所以功能还不是非常完"
+"\n善,难登大雅之堂。"
+"\n\n\t功能简介:"
+"\n本软件的播放清单文件保存在同目录下的"+"""+"list.ini"
+"""+"文件"+"\n下,如果系统不存在此文件则第一次打开的时候软件"
+"\n会自动建立。本软件能打开单个音乐文件或整个音乐"
+"\n目录,清单支持右键操作,当在列表中读取到不支持的"
+"\n文件时,此软件会自动把那个文件从清单清除,并另"
+"\n外播放一首歌。不过此软件有个不足之处,就是当你更"
+"\n改了清单的时候,要正常退出,即先关闭播放器,然后"
+"\n再关闭DOS窗口,因为我是在关闭播放器的时候保存清单"
+"\n文件的。不过你运行我编译出来的jar文件就没有此问题"
+"\n如果你使用中遇到任何问题,请通知我们,谢谢你的支持";
DialogDemo(Frame frame,String title)
{
super(frame,title);
field=new JTextArea();
field.setText(sValue);
field.setEditable(false);
c=getContentPane();
c.setLayout(new BorderLayout());
c.add(field,BorderLayout.CENTER);//默认为BorderLayout布局
setLocation(80,250);
setSize(300,350);
setResizable(false);
//setVisible(true);
}
}