libConsole/Getch.java
author Markus Brökers <mbroeker@largo.homelinux.org>
Mon, 30 Aug 2010 15:21:47 +0200
changeset 146 0ffa20c26b2d
parent 55 2a20d0184041
permissions -rw-r--r--
gauss.c: set a proper accuracy value: 1E-6

import java.io.*;

public class Getch {
    public static void main (String args[]) {
        int c;

        System.out.println ("Press q or ESCAPE to quit");

        for (;;) {
            c = Console.getch ();
            switch (c) {
            case 27:
            case 'q':
                System.exit (0);
                break;
            default:
                System.out.printf ("KEY: %c (%d)\n", c, c);
                break;
            }
        }
    };
}