System.err.println("unsupported key."); return 0;
LoggingSystem.getLogger().warning("unsupported key:" + key); if ( key >= 0x100 ) { return key - 0x100; } else { return 0; }
    public static int toInputCode(int key) {        switch (key) {        case KeyEvent.VK_ESCAPE:            return KEY_ESCAPE;        case KeyEvent.VK_1:            return KEY_1;        case KeyEvent.VK_2:            return KEY_2;        case KeyEvent.VK_3:            return KEY_3;        case KeyEvent.VK_4:            return KEY_4;        case KeyEvent.VK_5:            return KEY_5;        case KeyEvent.VK_6:            return KEY_6;        case KeyEvent.VK_7:            return KEY_7;        case KeyEvent.VK_8:            return KEY_8;        case KeyEvent.VK_9:            return KEY_9;        case KeyEvent.VK_0:            return KEY_0;        case KeyEvent.VK_MINUS:            return KEY_MINUS;        case KeyEvent.VK_EQUALS:            return KEY_EQUALS;        case KeyEvent.VK_BACK_SPACE:            return KEY_BACK;        case KeyEvent.VK_TAB:            return KEY_TAB;        case KeyEvent.VK_Q:            return KEY_Q;        case KeyEvent.VK_W:            return KEY_W;        case KeyEvent.VK_E:            return KEY_E;        case KeyEvent.VK_R:            return KEY_R;        case KeyEvent.VK_T:            return KEY_T;        case KeyEvent.VK_Y:            return KEY_Y;        case KeyEvent.VK_U:            return KEY_U;        case KeyEvent.VK_I:            return KEY_I;        case KeyEvent.VK_O:            return KEY_O;        case KeyEvent.VK_P:            return KEY_P;        case KeyEvent.VK_OPEN_BRACKET:            return KEY_LBRACKET;        case KeyEvent.VK_CLOSE_BRACKET:            return KEY_RBRACKET;        case KeyEvent.VK_ENTER:            return KEY_RETURN;        case KeyEvent.VK_CONTROL:            return KEY_LCONTROL;        case KeyEvent.VK_A:            return KEY_A;        case KeyEvent.VK_S:            return KEY_S;        case KeyEvent.VK_D:            return KEY_D;        case KeyEvent.VK_F:            return KEY_F;        case KeyEvent.VK_G:            return KEY_G;        case KeyEvent.VK_H:            return KEY_H;        case KeyEvent.VK_J:            return KEY_J;        case KeyEvent.VK_K:            return KEY_K;        case KeyEvent.VK_L:            return KEY_L;        case KeyEvent.VK_SEMICOLON:            return KEY_SEMICOLON;        case KeyEvent.VK_QUOTE:            return KEY_APOSTROPHE;        case KeyEvent.VK_DEAD_GRAVE:            return KEY_GRAVE;        case KeyEvent.VK_SHIFT:            return KEY_LSHIFT;        case KeyEvent.VK_BACK_SLASH:            return KEY_BACKSLASH;        case KeyEvent.VK_Z:            return KEY_Z;        case KeyEvent.VK_X:            return KEY_X;        case KeyEvent.VK_C:            return KEY_C;        case KeyEvent.VK_V:            return KEY_V;        case KeyEvent.VK_B:            return KEY_B;        case KeyEvent.VK_N:            return KEY_N;        case KeyEvent.VK_M:            return KEY_M;        case KeyEvent.VK_COMMA:            return KEY_COMMA;        case KeyEvent.VK_PERIOD:            return KEY_PERIOD;        case KeyEvent.VK_SLASH:            return KEY_SLASH;        case KeyEvent.VK_MULTIPLY:            return KEY_MULTIPLY;        case KeyEvent.VK_SPACE:            return KEY_SPACE;        case KeyEvent.VK_CAPS_LOCK:            return KEY_CAPITAL;        case KeyEvent.VK_F1:            return KEY_F1;        case KeyEvent.VK_F2:            return KEY_F2;        case KeyEvent.VK_F3:            return KEY_F3;        case KeyEvent.VK_F4:            return KEY_F4;        case KeyEvent.VK_F5:            return KEY_F5;        case KeyEvent.VK_F6:            return KEY_F6;        case KeyEvent.VK_F7:            return KEY_F7;        case KeyEvent.VK_F8:            return KEY_F8;        case KeyEvent.VK_F9:            return KEY_F9;        case KeyEvent.VK_F10:            return KEY_F10;        case KeyEvent.VK_NUM_LOCK:            return KEY_NUMLOCK;        case KeyEvent.VK_SCROLL_LOCK:            return KEY_SCROLL;        case KeyEvent.VK_NUMPAD7:            return KEY_NUMPAD7;        case KeyEvent.VK_NUMPAD8:            return KEY_NUMPAD8;        case KeyEvent.VK_NUMPAD9:            return KEY_NUMPAD9;        case KeyEvent.VK_SUBTRACT:            return KEY_SUBTRACT;        case KeyEvent.VK_NUMPAD4:            return KEY_NUMPAD4;        case KeyEvent.VK_NUMPAD5:            return KEY_NUMPAD5;        case KeyEvent.VK_NUMPAD6:            return KEY_NUMPAD6;        case KeyEvent.VK_ADD:            return KEY_ADD;        case KeyEvent.VK_NUMPAD1:            return KEY_NUMPAD1;        case KeyEvent.VK_NUMPAD2:            return KEY_NUMPAD2;        case KeyEvent.VK_NUMPAD3:            return KEY_NUMPAD3;        case KeyEvent.VK_NUMPAD0:            return KEY_NUMPAD0;        case KeyEvent.VK_DECIMAL:            return KEY_DECIMAL;        case KeyEvent.VK_F11:            return KEY_F11;        case KeyEvent.VK_F12:            return KEY_F12;        case KeyEvent.VK_F13:            return KEY_F13;        case KeyEvent.VK_F14:            return KEY_F14;        case KeyEvent.VK_F15:            return KEY_F15;        case KeyEvent.VK_KANA:            return KEY_KANA;        case KeyEvent.VK_CONVERT:            return KEY_CONVERT;        case KeyEvent.VK_NONCONVERT:            return KEY_NOCONVERT;        case KeyEvent.VK_CIRCUMFLEX:            return KEY_CIRCUMFLEX;        case KeyEvent.VK_AT:            return KEY_AT;        case KeyEvent.VK_COLON:            return KEY_COLON;        case KeyEvent.VK_UNDERSCORE:            return KEY_UNDERLINE;        case KeyEvent.VK_STOP:            return KEY_STOP;        case KeyEvent.VK_DIVIDE:            return KEY_DIVIDE;        case KeyEvent.VK_PAUSE:            return KEY_PAUSE;        case KeyEvent.VK_HOME:            return KEY_HOME;        case KeyEvent.VK_UP:            return KEY_UP;        case KeyEvent.VK_PAGE_UP:            return KEY_PRIOR;        case KeyEvent.VK_LEFT:            return KEY_LEFT;        case KeyEvent.VK_RIGHT:            return KEY_RIGHT;        case KeyEvent.VK_END:            return KEY_END;        case KeyEvent.VK_DOWN:            return KEY_DOWN;        case KeyEvent.VK_PAGE_DOWN:            return KEY_NEXT;        case KeyEvent.VK_INSERT:            return KEY_INSERT;        case KeyEvent.VK_DELETE:            return KEY_DELETE;        }        System.err.println("unsupported key.");        return 0;    }