libConsole/Getch.java
author Markus Bröker<broeker.markus@googlemail.com>
Fri, 20 Oct 2017 06:43:33 +0200
changeset 169 df7c720bcaa6
parent 55 2a20d0184041
permissions -rw-r--r--
Service Pack 1 for a software from 2008 :gg

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;
            }
        }
    };
}