/* Auteur: Nicolas JANEY          */
/* nicolas.janey@univ-fcomte.fr   */
/* Fevrier 2005                   */

import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class Console {

  public static FrameConsole fc = new FrameConsole();
  public static ConsolePrinter out = new ConsolePrinter(fc);
  public static ConsoleReader in = new ConsoleReader(fc);
  public static String line;
  
  public static void setTitle(String s) {
    fc.setTitle(s);
    fc.setKeyListeners();
  }
  
  public static void setKeyListeners() {
    fc.setKeyListeners();
  }

  public static byte saisirByte() {
    String s = in.readLine();
    byte v = Byte.parseByte(s);
    return(v);
  }

  public static short saisirShort() {
    String s = in.readLine();
    short v = Short.parseShort(s);
    return(v);
  }

  public static int saisirInt() {
    String s = in.readLine();
    int v = Integer.parseInt(s);
    return(v);
  }

  public static long saisirLong() {
    String s = in.readLine();
    long v = Long.parseLong(s);
    return(v);
  }
  
  public static float saisirFloat() {
    String s = in.readLine();
    float v = Float.parseFloat(s);
    return(v);
  }

  public static double saisirDouble() {
    String s = in.readLine();
    double v = Double.parseDouble(s);
    return(v);
  }

  public static char saisirChar() {
    String s = in.readLine();
    char v = s.charAt(0);
    return(v);
  }

  public static char attendreCaractere() {
    while ( in.sp == 0 ) {
      try {
        Thread.sleep(30); }
      catch (InterruptedException e) { }; }
    return(in.read());
  }

  public static String saisirString() {
    String s = in.readLine();
    return(s);
  }

	public static void afficher(Object... s) {
		for ( Object o : s ) {
			out.print(o.toString()); }
	}
	
	public static void afficherln(Object... s) {
		for ( Object o : s ) {
			out.print(o.toString()); }
		out.println();
	}
	
	public static void sautDeLigne() {
		out.println();
	}
  
	public static void formater(String format,Object... s) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(baos);
    ps.printf(Locale.US,format,s);
    out.print(baos);
	}
}