Example usage for java.awt.event KeyEvent VK_META

List of usage examples for java.awt.event KeyEvent VK_META

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_META.

Prototype

int VK_META

To view the source code for java.awt.event KeyEvent VK_META.

Click Source Link

Document

Constant for the META key.

Usage

From source file:Main.java

/**
 * gives default modifier of the current OS.
 * //from   www .java2 s . co m
 * @return meta (command) for OSX, control for Windows/Linux etc 
 */
public static int getSystemDefaultModifier() {
    if (!(UIManager.getLookAndFeel().getID().equals(METAL_LAF_ID))) {
        int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
        if (mask == Event.META_MASK) {
            return KeyEvent.VK_META;
        } else if (mask == Event.ALT_MASK) {
            return KeyEvent.VK_ALT;
        }
    }
    return KeyEvent.VK_CONTROL;
}

From source file:com.ubershy.streamsis.actions.HotkeyAction.java

/**
 * This method finds {@link KeyEvent} representation for "Shortcut" key. In Linux/Windows it's
 * "control" keyboard key. <br>//from w  w w .  java2  s .c om
 * In Mac it's "Meta"(Command) keyboard key.
 *
 * @return the int (KeyEvent)
 */
protected int defineShortcutKeyEvent() {
    int keyEvent = 0;
    OS os = LowLevel.getOS();
    switch (os) {
    case LINUX:
        keyEvent = KeyEvent.VK_CONTROL;
        break;
    case MAC:
        keyEvent = KeyEvent.VK_META;
        break;
    case WINDOWS:
        keyEvent = KeyEvent.VK_CONTROL;
        break;
    }
    if (keyEvent == 0) {
        throw new RuntimeException("Jeez, what system are you using?");
    }
    return keyEvent;
}

From source file:Main.java

public static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }//from ww w.j  a v  a  2 s  . com

    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";

    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";

    // numpad numeric keys handled below
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";

    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";

    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";

    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";

    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";

    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";

    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:Main.java

static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }// www.  j  av a 2s  .c  o m
    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";
    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";
    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";
    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";
    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";
    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";
    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";
    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:Main.java

static String getKeyText(int keyCode) {
    if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9
            || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
        return String.valueOf((char) keyCode);
    }// w  w  w  . j a v  a2 s.  c o  m
    switch (keyCode) {
    case KeyEvent.VK_COMMA:
        return "COMMA";
    case KeyEvent.VK_PERIOD:
        return "PERIOD";
    case KeyEvent.VK_SLASH:
        return "SLASH";
    case KeyEvent.VK_SEMICOLON:
        return "SEMICOLON";
    case KeyEvent.VK_EQUALS:
        return "EQUALS";
    case KeyEvent.VK_OPEN_BRACKET:
        return "OPEN_BRACKET";
    case KeyEvent.VK_BACK_SLASH:
        return "BACK_SLASH";
    case KeyEvent.VK_CLOSE_BRACKET:
        return "CLOSE_BRACKET";
    case KeyEvent.VK_ENTER:
        return "ENTER";
    case KeyEvent.VK_BACK_SPACE:
        return "BACK_SPACE";
    case KeyEvent.VK_TAB:
        return "TAB";
    case KeyEvent.VK_CANCEL:
        return "CANCEL";
    case KeyEvent.VK_CLEAR:
        return "CLEAR";
    case KeyEvent.VK_SHIFT:
        return "SHIFT";
    case KeyEvent.VK_CONTROL:
        return "CONTROL";
    case KeyEvent.VK_ALT:
        return "ALT";
    case KeyEvent.VK_PAUSE:
        return "PAUSE";
    case KeyEvent.VK_CAPS_LOCK:
        return "CAPS_LOCK";
    case KeyEvent.VK_ESCAPE:
        return "ESCAPE";
    case KeyEvent.VK_SPACE:
        return "SPACE";
    case KeyEvent.VK_PAGE_UP:
        return "PAGE_UP";
    case KeyEvent.VK_PAGE_DOWN:
        return "PAGE_DOWN";
    case KeyEvent.VK_END:
        return "END";
    case KeyEvent.VK_HOME:
        return "HOME";
    case KeyEvent.VK_LEFT:
        return "LEFT";
    case KeyEvent.VK_UP:
        return "UP";
    case KeyEvent.VK_RIGHT:
        return "RIGHT";
    case KeyEvent.VK_DOWN:
        return "DOWN";
    // numpad numeric keys handled below
    case KeyEvent.VK_MULTIPLY:
        return "MULTIPLY";
    case KeyEvent.VK_ADD:
        return "ADD";
    case KeyEvent.VK_SEPARATOR:
        return "SEPARATOR";
    case KeyEvent.VK_SUBTRACT:
        return "SUBTRACT";
    case KeyEvent.VK_DECIMAL:
        return "DECIMAL";
    case KeyEvent.VK_DIVIDE:
        return "DIVIDE";
    case KeyEvent.VK_DELETE:
        return "DELETE";
    case KeyEvent.VK_NUM_LOCK:
        return "NUM_LOCK";
    case KeyEvent.VK_SCROLL_LOCK:
        return "SCROLL_LOCK";
    case KeyEvent.VK_F1:
        return "F1";
    case KeyEvent.VK_F2:
        return "F2";
    case KeyEvent.VK_F3:
        return "F3";
    case KeyEvent.VK_F4:
        return "F4";
    case KeyEvent.VK_F5:
        return "F5";
    case KeyEvent.VK_F6:
        return "F6";
    case KeyEvent.VK_F7:
        return "F7";
    case KeyEvent.VK_F8:
        return "F8";
    case KeyEvent.VK_F9:
        return "F9";
    case KeyEvent.VK_F10:
        return "F10";
    case KeyEvent.VK_F11:
        return "F11";
    case KeyEvent.VK_F12:
        return "F12";
    case KeyEvent.VK_F13:
        return "F13";
    case KeyEvent.VK_F14:
        return "F14";
    case KeyEvent.VK_F15:
        return "F15";
    case KeyEvent.VK_F16:
        return "F16";
    case KeyEvent.VK_F17:
        return "F17";
    case KeyEvent.VK_F18:
        return "F18";
    case KeyEvent.VK_F19:
        return "F19";
    case KeyEvent.VK_F20:
        return "F20";
    case KeyEvent.VK_F21:
        return "F21";
    case KeyEvent.VK_F22:
        return "F22";
    case KeyEvent.VK_F23:
        return "F23";
    case KeyEvent.VK_F24:
        return "F24";
    case KeyEvent.VK_PRINTSCREEN:
        return "PRINTSCREEN";
    case KeyEvent.VK_INSERT:
        return "INSERT";
    case KeyEvent.VK_HELP:
        return "HELP";
    case KeyEvent.VK_META:
        return "META";
    case KeyEvent.VK_BACK_QUOTE:
        return "BACK_QUOTE";
    case KeyEvent.VK_QUOTE:
        return "QUOTE";
    case KeyEvent.VK_KP_UP:
        return "KP_UP";
    case KeyEvent.VK_KP_DOWN:
        return "KP_DOWN";
    case KeyEvent.VK_KP_LEFT:
        return "KP_LEFT";
    case KeyEvent.VK_KP_RIGHT:
        return "KP_RIGHT";
    case KeyEvent.VK_DEAD_GRAVE:
        return "DEAD_GRAVE";
    case KeyEvent.VK_DEAD_ACUTE:
        return "DEAD_ACUTE";
    case KeyEvent.VK_DEAD_CIRCUMFLEX:
        return "DEAD_CIRCUMFLEX";
    case KeyEvent.VK_DEAD_TILDE:
        return "DEAD_TILDE";
    case KeyEvent.VK_DEAD_MACRON:
        return "DEAD_MACRON";
    case KeyEvent.VK_DEAD_BREVE:
        return "DEAD_BREVE";
    case KeyEvent.VK_DEAD_ABOVEDOT:
        return "DEAD_ABOVEDOT";
    case KeyEvent.VK_DEAD_DIAERESIS:
        return "DEAD_DIAERESIS";
    case KeyEvent.VK_DEAD_ABOVERING:
        return "DEAD_ABOVERING";
    case KeyEvent.VK_DEAD_DOUBLEACUTE:
        return "DEAD_DOUBLEACUTE";
    case KeyEvent.VK_DEAD_CARON:
        return "DEAD_CARON";
    case KeyEvent.VK_DEAD_CEDILLA:
        return "DEAD_CEDILLA";
    case KeyEvent.VK_DEAD_OGONEK:
        return "DEAD_OGONEK";
    case KeyEvent.VK_DEAD_IOTA:
        return "DEAD_IOTA";
    case KeyEvent.VK_DEAD_VOICED_SOUND:
        return "DEAD_VOICED_SOUND";
    case KeyEvent.VK_DEAD_SEMIVOICED_SOUND:
        return "DEAD_SEMIVOICED_SOUND";
    case KeyEvent.VK_AMPERSAND:
        return "AMPERSAND";
    case KeyEvent.VK_ASTERISK:
        return "ASTERISK";
    case KeyEvent.VK_QUOTEDBL:
        return "QUOTEDBL";
    case KeyEvent.VK_LESS:
        return "LESS";
    case KeyEvent.VK_GREATER:
        return "GREATER";
    case KeyEvent.VK_BRACELEFT:
        return "BRACELEFT";
    case KeyEvent.VK_BRACERIGHT:
        return "BRACERIGHT";
    case KeyEvent.VK_AT:
        return "AT";
    case KeyEvent.VK_COLON:
        return "COLON";
    case KeyEvent.VK_CIRCUMFLEX:
        return "CIRCUMFLEX";
    case KeyEvent.VK_DOLLAR:
        return "DOLLAR";
    case KeyEvent.VK_EURO_SIGN:
        return "EURO_SIGN";
    case KeyEvent.VK_EXCLAMATION_MARK:
        return "EXCLAMATION_MARK";
    case KeyEvent.VK_INVERTED_EXCLAMATION_MARK:
        return "INVERTED_EXCLAMATION_MARK";
    case KeyEvent.VK_LEFT_PARENTHESIS:
        return "LEFT_PARENTHESIS";
    case KeyEvent.VK_NUMBER_SIGN:
        return "NUMBER_SIGN";
    case KeyEvent.VK_MINUS:
        return "MINUS";
    case KeyEvent.VK_PLUS:
        return "PLUS";
    case KeyEvent.VK_RIGHT_PARENTHESIS:
        return "RIGHT_PARENTHESIS";
    case KeyEvent.VK_UNDERSCORE:
        return "UNDERSCORE";
    case KeyEvent.VK_FINAL:
        return "FINAL";
    case KeyEvent.VK_CONVERT:
        return "CONVERT";
    case KeyEvent.VK_NONCONVERT:
        return "NONCONVERT";
    case KeyEvent.VK_ACCEPT:
        return "ACCEPT";
    case KeyEvent.VK_MODECHANGE:
        return "MODECHANGE";
    case KeyEvent.VK_KANA:
        return "KANA";
    case KeyEvent.VK_KANJI:
        return "KANJI";
    case KeyEvent.VK_ALPHANUMERIC:
        return "ALPHANUMERIC";
    case KeyEvent.VK_KATAKANA:
        return "KATAKANA";
    case KeyEvent.VK_HIRAGANA:
        return "HIRAGANA";
    case KeyEvent.VK_FULL_WIDTH:
        return "FULL_WIDTH";
    case KeyEvent.VK_HALF_WIDTH:
        return "HALF_WIDTH";
    case KeyEvent.VK_ROMAN_CHARACTERS:
        return "ROMAN_CHARACTERS";
    case KeyEvent.VK_ALL_CANDIDATES:
        return "ALL_CANDIDATES";
    case KeyEvent.VK_PREVIOUS_CANDIDATE:
        return "PREVIOUS_CANDIDATE";
    case KeyEvent.VK_CODE_INPUT:
        return "CODE_INPUT";
    case KeyEvent.VK_JAPANESE_KATAKANA:
        return "JAPANESE_KATAKANA";
    case KeyEvent.VK_JAPANESE_HIRAGANA:
        return "JAPANESE_HIRAGANA";
    case KeyEvent.VK_JAPANESE_ROMAN:
        return "JAPANESE_ROMAN";
    case KeyEvent.VK_KANA_LOCK:
        return "KANA_LOCK";
    case KeyEvent.VK_INPUT_METHOD_ON_OFF:
        return "INPUT_METHOD_ON_OFF";

    case KeyEvent.VK_AGAIN:
        return "AGAIN";
    case KeyEvent.VK_UNDO:
        return "UNDO";
    case KeyEvent.VK_COPY:
        return "COPY";
    case KeyEvent.VK_PASTE:
        return "PASTE";
    case KeyEvent.VK_CUT:
        return "CUT";
    case KeyEvent.VK_FIND:
        return "FIND";
    case KeyEvent.VK_PROPS:
        return "PROPS";
    case KeyEvent.VK_STOP:
        return "STOP";

    case KeyEvent.VK_COMPOSE:
        return "COMPOSE";
    case KeyEvent.VK_ALT_GRAPH:
        return "ALT_GRAPH";
    }

    if (keyCode >= KeyEvent.VK_NUMPAD0 && keyCode <= KeyEvent.VK_NUMPAD9) {
        char c = (char) (keyCode - KeyEvent.VK_NUMPAD0 + '0');
        return "NUMPAD" + c;
    }

    return "unknown(0x" + Integer.toString(keyCode, 16) + ")";
}

From source file:edu.ku.brc.af.ui.db.TextFieldWithQuery.java

/**
 * Processes the KeyEvent.//from www.  j  av a2s.  c o m
 * @param ev event
 */
protected void cbxKeyReleased(KeyEvent ev) {
    if (isReadOnlyMode) {
        return;
    }
    if (ev.getKeyCode() == KeyEvent.VK_SHIFT || ev.getKeyCode() == KeyEvent.VK_LEFT
            || ev.getKeyCode() == KeyEvent.VK_RIGHT || ev.getKeyCode() == KeyEvent.VK_CONTROL
            || ev.getKeyCode() == KeyEvent.VK_META) {
        return;
    }

    currentText = textField.getText();
    if (uiFieldFormatter != null) {
        currentText = uiFieldFormatter.formatFromUI(currentText).toString();
    }
    if (currentText.length() == 0 || !hasNewText) {
        if (ev.getKeyCode() == KeyEvent.VK_TAB) {
            if (ev.isShiftDown()) {
                textField.transferFocusBackward();
            } else {
                textField.transferFocus();
            }
            return;
        }

        if (ev.getKeyCode() == JAutoCompComboBox.SEARCH_KEY || ev.getKeyCode() == KeyEvent.VK_DOWN) {
            showPopup(0); // add only
            return;
        }

        if (ev.getKeyCode() != KeyEvent.VK_ENTER) {
            // Add variable to track whether it once had a value and now it does not rods - 02/28/08

            idList.clear();
            list.clear();
            selectedId = null;

            // 02/09/08 - This should not be done here - rods
            // The reason is, that we may have added something only to remove
            // before leaving the control. So we should never send the notification
            // just because we delete the contents. (see wasCleared above)

            /*if (listSelectionListeners != null)
            {
            notifyListenersOfChange(TextFieldWithQuery.this);
            }*/
            //log.debug("setting hasNewText to true"); //$NON-NLS-1$
            hasNewText = true;
        }
    } else {
        hasNewText = true;
        //log.debug("setting hasNewText to true");
    }

    if (ev.getKeyCode() == JAutoCompComboBox.SEARCH_KEY || ev.getKeyCode() == KeyEvent.VK_TAB
            || ev.getKeyCode() == KeyEvent.VK_DOWN) {
        String origText = textField.getText();
        String text = origText;
        if (uiFieldFormatter != null && !uiFieldFormatter.isNumeric()) {
            text = uiFieldFormatter.formatFromUI(text).toString();
        }
        text = StringUtils.replace(text, "'", "\'");
        text = StringUtils.replace(text, "\"", "\\\"");

        // direction of focus change 1: forward 0: none -1: backwards
        int focusChange = (ev.isShiftDown() ? -1 : 1) * (ev.getKeyCode() == KeyEvent.VK_TAB ? 1 : 0);
        doQuery(text, origText, focusChange);
    }
}

From source file:edu.ku.brc.ui.tmanfe.SpreadSheet.java

@Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
    if (e.getKeyCode() == KeyEvent.VK_META) {
        return false;
    }//  w  ww  . ja va  2s .  com
    return super.processKeyBinding(ks, e, condition, pressed);
}

From source file:org.eclipse.jubula.rc.common.driver.KeyTyper.java

/**
 * @param keyStroke KeyStroke whose modifiers are requested
 * @return a List of KeyCodes (hopefully) realising the ModifierMask contained in the KeyStroke
 *//* w  w  w  .j a v  a  2  s  .co  m*/
private List modifierKeyCodes(KeyStroke keyStroke) {
    List l = new LinkedList();
    int modifiers = keyStroke.getModifiers();
    // this is jdk 1.3 - code.
    // use ALT_DOWN_MASK instead etc. with jdk 1.4 !
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        l.add(new Integer(KeyEvent.VK_ALT));
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        l.add(new Integer(KeyEvent.VK_ALT_GRAPH));
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        l.add(new Integer(KeyEvent.VK_CONTROL));
    }
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        l.add(new Integer(KeyEvent.VK_SHIFT));
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        l.add(new Integer(KeyEvent.VK_META));
    }
    return l;
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserUI.java

/** 
 * Helper method to create the trees hosting the display. 
 * /*  w w w. ja  v a2s  .  c  o  m*/
 * @param exp The logged in experimenter.
 */
private void createTrees(ExperimenterData exp) {
    treeDisplay = new DnDTree(model.getUserID(), TreeViewerAgent.isAdministrator());
    treeDisplay.addPropertyChangeListener(this);
    String key = "meta pressed A";
    if (UIUtilities.isWindowsOS())
        key = "ctrl pressed A";
    KeyStroke ks = KeyStroke.getKeyStroke(key);
    treeDisplay.getInputMap().put(ks, "none");
    treeDisplay.setVisible(true);
    treeDisplay.setRootVisible(false);
    ToolTipManager.sharedInstance().registerComponent(treeDisplay);
    treeDisplay.setCellRenderer(new TreeCellRenderer(model.getUserID()));
    treeDisplay.setShowsRootHandles(true);
    TreeImageSet root = new TreeImageSet("");
    treeDisplay.setModel(new DefaultTreeModel(root));
    if (model.getBrowserType() != Browser.ADMIN_EXPLORER) {
        TreeImageDisplay node = buildTreeNodes(exp);
        if (node != null)
            treeDisplay.collapsePath(new TreePath(node.getPath()));
    }
    //Add Listeners
    //treeDisplay.requestFocus();
    treeDisplay.addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            mousePressedTime = e.getWhen();
            rightClickPad = UIUtilities.isMacOS() && SwingUtilities.isLeftMouseButton(e) && e.isControlDown();
            rightClickButton = SwingUtilities.isRightMouseButton(e);
            ctrl = e.isControlDown();
            if (UIUtilities.isMacOS())
                ctrl = e.isMetaDown();
            leftMouseButton = SwingUtilities.isLeftMouseButton(e);
            if (UIUtilities.isMacOS() || UIUtilities.isLinuxOS())
                onClick(e, false);
        }

        public void mouseReleased(MouseEvent e) {
            leftMouseButton = SwingUtilities.isLeftMouseButton(e);
            if (UIUtilities.isWindowsOS())
                onClick(e, true);
        }

        // public void mouseMoved(MouseEvent e) { rollOver(e); }
    });
    treeDisplay.addMouseMotionListener(new MouseMotionAdapter() {

        public void mouseMoved(MouseEvent e) {
            rollOver(e);
        }
    });
    treeDisplay.addTreeExpansionListener(listener);
    selectionListener = new TreeSelectionListener() {

        public void valueChanged(TreeSelectionEvent e) {
            event = e;
            eventHandledTime = System.currentTimeMillis();

            if (delayedHandlingTreeSelection)
                /* mouse click delayed handling until this event occurred */
                handleTreeSelection();

            switch (keyEvent) {
            case KeyEvent.VK_DOWN:
            case KeyEvent.VK_UP:
                TreePath[] paths = treeDisplay.getSelectionPaths();
                if (paths != null)
                    controller.onClick(Arrays.asList(paths));
                else
                    controller.onClick(new ArrayList<TreePath>());
                break;
            }
        }
    };
    treeDisplay.addTreeSelectionListener(selectionListener);
    //remove standard behaviour
    treeDisplay.addKeyListener(new KeyAdapter() {

        public void keyPressed(KeyEvent e) {
            ctrl = false;
            switch (e.getKeyCode()) {
            case KeyEvent.VK_ENTER:
                ViewCmd cmd = new ViewCmd(model.getParentModel(), true);
                cmd.execute();
                break;
            case KeyEvent.VK_DELETE:
                switch (model.getState()) {
                case Browser.LOADING_DATA:
                case Browser.LOADING_LEAVES:
                    //case Browser.COUNTING_ITEMS:  
                    break;
                default:
                    model.delete();
                }
                break;
            case KeyEvent.VK_CONTROL:
                if (!UIUtilities.isMacOS())
                    ctrl = true;
                break;
            case KeyEvent.VK_META:
                if (UIUtilities.isMacOS())
                    ctrl = true;
                break;
            case KeyEvent.VK_A:
                if (UIUtilities.isWindowsOS() && e.isControlDown()
                        || !UIUtilities.isWindowsOS() && e.isMetaDown()) {
                    handleMultiSelection();
                }
                break;
            case KeyEvent.VK_DOWN:
            case KeyEvent.VK_UP:
            case KeyEvent.VK_RIGHT:
                keyEvent = e.getKeyCode();
                break;
            case KeyEvent.VK_LEFT:
                TreePath[] paths = treeDisplay.getSelectionPaths();
                TreeImageDisplay node;
                Object o;
                for (int i = 0; i < paths.length; i++) {
                    o = paths[i].getLastPathComponent();
                    if (o instanceof TreeImageDisplay) {
                        node = (TreeImageDisplay) o;
                        if (node.isExpanded())
                            node.setExpanded(false);
                    }
                }
            }
        }

        public void keyReleased(KeyEvent e) {
            ctrl = false;
            keyEvent = -1;
        }

    });
}

From source file:org.safs.selenium.webdriver.lib.WDLibrary.java

/**
 * Convert a Java KEYCODE to a Selenium WebDriver Keys Enum
 * @param keycode int, a java keycode/*from   w  w  w .j  av a2  s .  c  o m*/
 * @return Keys enum for (primarily) non-printable (control) characters, or null.
 */
public static Keys convertToKeys(int keycode) {
    Keys key = null;
    switch (keycode) {
    case java.awt.event.KeyEvent.VK_ADD:
        key = Keys.ADD;
        break;
    case java.awt.event.KeyEvent.VK_ALT:
        key = Keys.ALT;
        break;
    case java.awt.event.KeyEvent.VK_KP_DOWN:
        key = Keys.ARROW_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_KP_LEFT:
        key = Keys.ARROW_LEFT;
        break;
    case java.awt.event.KeyEvent.VK_KP_RIGHT:
        key = Keys.ARROW_RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_KP_UP:
        key = Keys.ARROW_UP;
        break;
    case java.awt.event.KeyEvent.VK_BACK_SPACE:
        key = Keys.BACK_SPACE;
        break;
    case java.awt.event.KeyEvent.VK_CANCEL:
        key = Keys.CANCEL;
        break;
    case java.awt.event.KeyEvent.VK_CLEAR:
        key = Keys.CLEAR;
        break;
    case java.awt.event.KeyEvent.VK_WINDOWS:
        key = Keys.COMMAND;
        break;
    case java.awt.event.KeyEvent.VK_CONTROL:
        key = Keys.CONTROL;
        break;
    case java.awt.event.KeyEvent.VK_DECIMAL:
        key = Keys.DECIMAL;
        break;
    case java.awt.event.KeyEvent.VK_DELETE:
        key = Keys.DELETE;
        break;
    case java.awt.event.KeyEvent.VK_DIVIDE:
        key = Keys.DIVIDE;
        break;
    case java.awt.event.KeyEvent.VK_DOWN:
        key = Keys.DOWN;
        break;
    case java.awt.event.KeyEvent.VK_END:
        key = Keys.END;
        break;
    case java.awt.event.KeyEvent.VK_ENTER:
        key = Keys.ENTER;
        break;
    case java.awt.event.KeyEvent.VK_EQUALS:
        key = Keys.EQUALS;
        break;
    case java.awt.event.KeyEvent.VK_ESCAPE:
        key = Keys.ESCAPE;
        break;
    case java.awt.event.KeyEvent.VK_F1:
        key = Keys.F1;
        break;
    case java.awt.event.KeyEvent.VK_F2:
        key = Keys.F2;
        break;
    case java.awt.event.KeyEvent.VK_F3:
        key = Keys.F3;
        break;
    case java.awt.event.KeyEvent.VK_F4:
        key = Keys.F4;
        break;
    case java.awt.event.KeyEvent.VK_F5:
        key = Keys.F5;
        break;
    case java.awt.event.KeyEvent.VK_F6:
        key = Keys.F6;
        break;
    case java.awt.event.KeyEvent.VK_F7:
        key = Keys.F7;
        break;
    case java.awt.event.KeyEvent.VK_F8:
        key = Keys.F8;
        break;
    case java.awt.event.KeyEvent.VK_F9:
        key = Keys.F9;
        break;
    case java.awt.event.KeyEvent.VK_F10:
        key = Keys.F10;
        break;
    case java.awt.event.KeyEvent.VK_F11:
        key = Keys.F11;
        break;
    case java.awt.event.KeyEvent.VK_F12:
        key = Keys.F12;
        break;
    case java.awt.event.KeyEvent.VK_HELP:
        key = Keys.HELP;
        break;
    case java.awt.event.KeyEvent.VK_HOME:
        key = Keys.HOME;
        break;
    case java.awt.event.KeyEvent.VK_INSERT:
        key = Keys.INSERT;
        break;
    case java.awt.event.KeyEvent.VK_LEFT:
        key = Keys.LEFT;
        break;
    case java.awt.event.KeyEvent.VK_META:
        key = Keys.META;
        break;
    case java.awt.event.KeyEvent.VK_MULTIPLY:
        key = Keys.MULTIPLY;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD0:
        key = Keys.NUMPAD0;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD1:
        key = Keys.NUMPAD1;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD2:
        key = Keys.NUMPAD2;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD3:
        key = Keys.NUMPAD3;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD4:
        key = Keys.NUMPAD4;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD5:
        key = Keys.NUMPAD5;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD6:
        key = Keys.NUMPAD6;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD7:
        key = Keys.NUMPAD7;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD8:
        key = Keys.NUMPAD8;
        break;
    case java.awt.event.KeyEvent.VK_NUMPAD9:
        key = Keys.NUMPAD9;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_DOWN:
        key = Keys.PAGE_DOWN;
        break;
    case java.awt.event.KeyEvent.VK_PAGE_UP:
        key = Keys.PAGE_UP;
        break;
    case java.awt.event.KeyEvent.VK_PAUSE:
        key = Keys.PAUSE;
        break;
    case java.awt.event.KeyEvent.VK_RIGHT:
        key = Keys.RIGHT;
        break;
    case java.awt.event.KeyEvent.VK_SEMICOLON:
        key = Keys.SEMICOLON;
        break;
    case java.awt.event.KeyEvent.VK_SEPARATOR:
        key = Keys.SEPARATOR;
        break;
    case java.awt.event.KeyEvent.VK_SHIFT:
        key = Keys.SHIFT;
        break;
    case java.awt.event.KeyEvent.VK_SPACE:
        key = Keys.SPACE;
        break;
    case java.awt.event.KeyEvent.VK_SUBTRACT:
        key = Keys.SUBTRACT;
        break;
    case java.awt.event.KeyEvent.VK_TAB:
        key = Keys.TAB;
        break;
    case java.awt.event.KeyEvent.VK_UP:
        key = Keys.UP;
        break;
    }
    return key;
}