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
|
public static void main(String[] args) {
FileInputStream fichierScoreEntree;
try {
JFileChooser dialogue = new JFileChooser(new File("."));
File fichier = null;
if (dialogue.showOpenDialog(null)==
JFileChooser.APPROVE_OPTION) {
fichier = dialogue.getSelectedFile();
}
if(fichier != null){
fichierScoreEntree = new FileInputStream(fichier);
InputStreamReader ipsr=new InputStreamReader(fichierScoreEntree);
BufferedReader br=new BufferedReader(ipsr);
String ligne;
System.out.println("Djokovic" + " - " + "MacEnroe");
while ((ligne=br.readLine())!=null){
if(DJOKOVIC.equals(ligne)){
pointDjokovic ++;
} else if (MACENROE.equals(ligne)){
pointMacEnroe ++;
}
System.out.println(getScore());
}
br.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} |