Results 1 to 2 of 2
- 05-30-2008, 05:02 PM #1
Member
- Join Date
- May 2008
- Posts
- 3
- Rep Power
- 0
how can I play an mp3 file in java?
hey, I've written something in another thread but it is a little old so...I hope you see it here..
I want to play an mp3 file and the code in eclipse is something like the following ... I see the interface but it can't be played...
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
public class AudioFilee extends JFrame {
public AudioFilee() {
setTitle("Music File");
setSize(300, 400);
JPanel jp1 = new JPanel();
JPanel jp2 = new JPanel();
JButton s= new JButton("STOP");
JButton p= new JButton("PLAY");
JLabel j1 = new JLabel("MusicFile");
String[] musicfiles={"workspace/eclipse/Audio/asdf.mp3","asd.mp3"};
JComboBox musiclist=new JComboBox(musicfiles);
musiclist.setSelectedIndex(1);
jp1.add(j1);
jp1.add(musiclist);
jp2.add(s);
jp2.add(p);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
true, jp1, jp2);
splitPane.setOneTouchExpandable(true);
getContentPane().add(splitPane);
}
public static void main(String[] args) {
AudioFilee sp = new AudioFilee();
sp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
sp.setVisible(true);
}
}
Do you have any suggestion? Thanks
- 05-30-2008, 07:32 PM #2
Member
- Join Date
- May 2008
- Posts
- 26
- Rep Power
- 0
Similar Threads
-
How to play movie using java
By sithara in forum New To JavaReplies: 3Last Post: 02-20-2013, 12:29 PM -
How to play video files in Java
By Hasan in forum Advanced JavaReplies: 11Last Post: 04-26-2009, 11:57 PM -
play() and mp3
By willemjav in forum Advanced JavaReplies: 3Last Post: 12-23-2007, 02:50 PM -
Make sound play in a java application
By lenny in forum AWT / SwingReplies: 2Last Post: 08-13-2007, 11:45 AM -
how to play MIDI in java application?
By oregon in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 02:26 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks