import java.io.*;
import javax.swing.*;

public class FichierTest{
  public static void main(String[] args) throws Exception{
    JFileChooser selecteur = new JFileChooser(new File("."));
    int reponse = selecteur.showOpenDialog(null);
    if (reponse != JFileChooser.APPROVE_OPTION)
      throw  new Exception();
    File f = selecteur.getSelectedFile();
    if (f == null || !f.exists()) 
      throw new FileNotFoundException("fichier");
    int x;
    String mot;
    StreamTokenizer in = new StreamTokenizer(new FileReader(f));
    do {
      in.nextToken();
      if (in.ttype == StreamTokenizer.TT_NUMBER)
           System.out.println((int) in.nval);
      if (in.ttype == StreamTokenizer.TT_WORD)
            System.out.println(in.sval);
    } while (in.ttype != StreamTokenizer.TT_EOF);
    System.exit(0);
  }
  
}

