Example usage for java.awt Event controlDown

List of usage examples for java.awt Event controlDown

Introduction

In this page you can find the example usage for java.awt Event controlDown.

Prototype

public boolean controlDown() 

Source Link

Document

NOTE: The Event class is obsolete and is available only for backwards compatibility.

Usage

From source file:EventTester.java

private String key_name(Event e) {
    char c = (char) e.key;
    if (e.controlDown()) { // If CTRL flag is set, handle control chars.
        if (c < ' ') {
            c += '@';
            return "^" + c;
        }/*from   w w w. j av  a  2s. co m*/
    } else { // If CTRL flag is not set, then certain ASCII
        switch (c) { // control characters have special meaning.
        case '\n':
            return "Return";
        case '\t':
            return "Tab";
        case '\033':
            return "Escape";
        case '\010':
            return "Backspace";
        }
    }
    // Handle the remaining possibilities.
    if (c == '\177')
        return "Delete";
    else if (c == ' ')
        return "Space";
    else
        return String.valueOf(c);
}