1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
| public class mp3 extends JFrame {
private Player lecteur;
private String lists [];
//private File fichier;
//private String urls []= {"01.mp3","02.mp3","03.mp3","04.mp3"};;
int currentsong = 0;//,i;
public mp3()
{
super( "Java Media Player" );
JButton ouvrirFichier = new JButton( "Go" );
JButton Suivant=new JButton("Suiv.");
JButton Precedent=new JButton("Préc.");
JButton Stop = new JButton( "Stop" );
Suivant.setPreferredSize(new Dimension(80,20));
Precedent.setPreferredSize(new Dimension(80,20));
Stop.setPreferredSize(new Dimension(80,20));
ouvrirFichier.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e )
{
getlist();
}
});
private void getlist(){
String essay[] = null;
int i = 0;
//Loop across the arguments
String adressedufichier = System.getProperty("user.dir") + "\\src\\pair\\list.txt";
//Open the file for reading
try {
FileReader fr = new FileReader(adressedufichier);
BufferedReader br = new BufferedReader(fr);
while ((br.readLine()) != null) { // while loop begins here
lists[currentsong]=br.readLine(); // marche pas.....................
currentsong+=1;
//essay[i]=lists[i];
// i++;
//System.out.println(thisLine);
//thisLine=essay[i];
} // end while
} // end try
catch (IOException e) {
System.err.println("Error: " + e);
}
}
} |
Partager