import  java.util.*;     // pour acéder à 'Scanner' 
import  javax.swing.*;   // pour acéder à  'JOptionPane'
import  java.io.*;       // pour acéder à  'PrintWriter'
/**  Classe 'test_scan' :   Autre test de 'Scanner' (cf.   JDK 1.5  et ultérieur ...)   et de 'printf' ...
  * @author   (c) ~/2A env.   
  * @since     0.95  2005.03.13
  * @version  1.1   2009.09.11
  * @see         tscan
  * @see         vscanner
  */
class  test_scan  {

/**  jin: champ  de classe  de type 'Scanner' <===> alias de 'System.in' pour JDK 1.4 ou antérieure ...      */
	static Scanner jin = new Scanner(System.in);
/**  jo: champ  de classe de type 'PrintWriter'  <===> alias de 'System.out' pour JDK 1.4 ou antérieure ...      */
	static PrintWriter jo = new PrintWriter(System.out, true);
/**   Méthode principale publique et de classe   'main(...)'.
   * @param arg   Tableau de chaînes pour ligne de commande éventuelle
   */
	public static void main(String arg [])  {
		
		jo.print("test_scan: Test de 'Scanner' et de 'printf'");
		jo.println("\t(c)~/2A env. 2009.09.11 10:55");
		jo.println("---------  \n");


        JOptionPane.showMessageDialog(null,"Dans la fenêtre 'console', taper 2 chaînes, 2 entiers puis 2 réels...", 
		"Test de 'Scanner' et de 'printf' (c)~/2A env. 2009.09.11", JOptionPane.WARNING_MESSAGE);

        JOptionPane.showMessageDialog(null,"                                                       ", 
		"Tapez une phrase entre les guillements, SVP :", JOptionPane.WARNING_MESSAGE);
 		String phrase =    jin.nextLine();  
		System.out.printf("phrase = %s\n\n", phrase);

		JOptionPane.showMessageDialog(null,"                                                      ", 
		"Taper un mot : ", JOptionPane.WARNING_MESSAGE);
		String mot= jin.next();    
		System.out.printf("mot = %s\n\n", mot);
		
		JOptionPane.showMessageDialog(null,"                                                      ", 
		"Taper un entier 'int' : ", JOptionPane.WARNING_MESSAGE);
		int m = jin.nextInt();  // <=>	int  m = Integer.parseInt( es.LireCh() );
		System.out.printf("m = %d\n\n", m);		
	
		JOptionPane.showMessageDialog(null,"                                                      ", 
		"Taper un entier 'long' : ", JOptionPane.WARNING_MESSAGE);
		long n = jin.nextLong();  //	long n = Long.parseLong( es.LireCh() );      
		System.out.printf("n = %d\n\n", n);

		JOptionPane.showMessageDialog(null,"                                                      ", 
		"Taper un réel 'float' (Ex.: 3,1416) : ", JOptionPane.WARNING_MESSAGE);
		float  x = jin.nextFloat(); //  float x = Float.parseFloat(es.LireCh() );      
		System.out.printf("x = %8.2f\n\n", x);

		JOptionPane.showMessageDialog(null,"                                                      ", 
		"Taper un réel 'double' (Ex.: 2,71111111111) : ", JOptionPane.WARNING_MESSAGE);
		double y = jin.nextDouble();  //  double y  = Double.parseDouble(es.LireCh() );      
		System.out.printf("y = %14.7e\n\n", y);
		
		es.attente();
	}
}