爱问知识人 爱问教育 医院库

Java如何实现MP3播放!!

首页

Java如何实现MP3播放!!

做东西,需要背景音乐!!谁知道Java有哪些相关的类可以实现MP3音乐文件的播放吗?没有代码的话告诉我哪些类可以也升行啊

提交回答
好评回答
  • 2006-06-03 11:26:50
      import  t。*;
    import  t。event。*;
    import  。*;
    import javax。swing。*;
    import  dia。*;
    public class JMFTest
        extends JFrame {
        private Player player;
        private File file;
        public JMFTest() {
            super("JMF-代刚祘Α(by Sungo)");
            JButton openFile = new JButton("叫匡璶冀郎 (*。
      Wav*。MP3*。MIDI。。)"); tFont(new t。Font("灿砰", 0, 15)); tForeground(new Color(255, 255, 255)); tBackground(new Color(204, 102, 255)); dActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { openFile(); createPlayer(); } } ); getContentPane()。
      add(openFile, BorderLayout。SOUTH); setSize(365, 84); show(); try { jbInit(); } catch (Exception e) { intStackTrace(); } } private void openFile() { JFileChooser fileChooser = new JFileChooser(); tFileSelectionMode( JFileChooser。
      FILES_ONLY); int result = owOpenDialog(this); if (result == JFileChooser。CANCEL_OPTION) { file = null; } else { file = tSelectedFile(); } } private void createPlayer() { if (file == null) { return; } removePreviousPlayer(); try { player = eatePlayer( URL()); dControllerListener(new EventHandler()); art(); } catch (Exception e) { owMessageDialog(this, "郎摸岿粇┪琌тぃ赣郎竚", "岿粇癟矗ボ", JOptionPane。
      ERROR_MESSAGE); } } private void removePreviousPlayer() { if (player == null) { return; } ose(); Component visual = tVisualComponent(); Component control = tControlPanelComponent(); Container c = getContentPane(); if (visual != null) { move(visual); } if (control != null) { move(control); } } public static void main(String args[]) { JMFTest app = new JMFTest(); dWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System。
      exit(0); } } ); } private class EventHandler implements ControllerListener { public void controllerUpdate(ControllerEvent e) { if (e instanceof RealizeCompleteEvent) { Container c = getContentPane(); Component visualComponent = tVisualComponent(); if (visualComponent != null) { d(visualComponent, BorderLayout。
      CENTER); } Component controlsComponent = tControlPanelComponent(); if (controlsComponent != null) { d(controlsComponent, BorderLayout。
      NORTH); } Layout(); } } } private void jbInit() throws Exception { tDefaultCloseOperation(HIDE_ON_CLOSE); tContentPane()。
      setBackground(new Color(0, 102, 255)); tResizable(false); } } ------------- 繁体字都变成乱码了,本来想传整个文件的,但太大了,IASK居然只能传200K的东西。
      

    y***

    2006-06-03 11:26:50

其他答案

    2006-05-31 21:02:45
  • sun在做一个JMF,就是java媒体框架,主要是用于流媒体的实时传递功能的,但也包含播放功能在里面,你可以自己查查

    c***

    2006-05-31 21:02:45

类似问题

换一换

相关推荐

正在加载...
最新问答 推荐信息 热门专题 热点推荐
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200
  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 181-200

热点检索

  • 1-20
  • 21-40
  • 41-60
  • 61-80
  • 81-100
  • 101-120
  • 121-140
  • 141-160
  • 161-180
  • 175-194
返回
顶部
帮助 意见
反馈

确定举报此问题

举报原因(必选):