String (int code) { return switch (code) { case KeyEvent.VK_ENTER -> "Enter"; case KeyEvent.VK_BACK_SPACE -> "Backspace"; case KeyEvent.VK_TAB -> "Tab"; case KeyEvent.VK_CANCEL -> "Cancel"; case KeyEvent.VK_CLEAR -> "Clear"; case KeyEvent.VK_COMPOSE -> "Compose"; case KeyEvent.VK_PAUSE -> "Pause"; case KeyEvent.VK_CAPS_LOCK -> "Caps Lock"; case KeyEvent.VK_ESCAPE -> "Escape"; case KeyEvent.VK_SPACE -> "Space"; case KeyEvent.VK_PAGE_UP -> "Page Up"; case KeyEvent.VK_PAGE_DOWN -> "Page Down"; case KeyEvent.VK_END -> "End"; case KeyEvent.VK_HOME -> "Home"; case KeyEvent.VK_LEFT -> "Left"; case KeyEvent.VK_UP -> "Up"; case KeyEvent.VK_RIGHT -> "Right"; case KeyEvent.VK_DOWN -> "Down"; case KeyEvent.VK_BEGIN -> "Begin"; // modifiers case KeyEvent.VK_SHIFT -> "Shift"; case KeyEvent.VK_CONTROL -> "Control"; case KeyEvent.VK_ALT -> "Alt"; case KeyEvent.VK_META -> "Meta"; case KeyEvent.VK_ALT_GRAPH -> "Alt Graph"; // numpad numeric keys handled below case KeyEvent.VK_MULTIPLY -> "NumPad *"; case KeyEvent.VK_ADD -> "NumPad +"; case KeyEvent.VK_SEPARATOR -> "NumPad ,"; case KeyEvent.VK_SUBTRACT -> "NumPad -"; case KeyEvent.VK_DECIMAL -> "NumPad ."; case KeyEvent.VK_DIVIDE -> "NumPad /"; case KeyEvent.VK_DELETE -> "Delete"; case KeyEvent.VK_NUM_LOCK -> "Num Lock"; case KeyEvent.VK_SCROLL_LOCK -> "Scroll Lock"; case KeyEvent.VK_WINDOWS -> "Windows"; case KeyEvent.VK_CONTEXT_MENU -> "Context Menu"; case KeyEvent.VK_F1 -> "F1"; case KeyEvent.VK_F2 -> "F2"; case KeyEvent.VK_F3 -> "F3"; case KeyEvent.VK_F4 -> "F4"; case KeyEvent.VK_F5 -> "F5"; case KeyEvent.VK_F6 -> "F6"; case KeyEvent.VK_F7 -> "F7"; case KeyEvent.VK_F8 -> "F8"; case KeyEvent.VK_F9 -> "F9"; case KeyEvent.VK_F10 -> "F10"; case KeyEvent.VK_F11 -> "F11"; case KeyEvent.VK_F12 -> "F12"; case KeyEvent.VK_F13 -> "F13"; case KeyEvent.VK_F14 -> "F14"; case KeyEvent.VK_F15 -> "F15"; case KeyEvent.VK_F16 -> "F16"; case KeyEvent.VK_F17 -> "F17"; case KeyEvent.VK_F18 -> "F18"; case KeyEvent.VK_F19 -> "F19"; case KeyEvent.VK_F20 -> "F20"; case KeyEvent.VK_F21 -> "F21"; case KeyEvent.VK_F22 -> "F22"; case KeyEvent.VK_F23 -> "F23"; case KeyEvent.VK_F24 -> "F24"; case KeyEvent.VK_PRINTSCREEN -> "Print Screen"; case KeyEvent.VK_INSERT -> "Insert"; case KeyEvent.VK_HELP -> "Help"; case KeyEvent.VK_KP_UP -> "Up"; case KeyEvent.VK_KP_DOWN -> "Down"; case KeyEvent.VK_KP_LEFT -> "Left"; case KeyEvent.VK_KP_RIGHT -> "Right"; default -> getKeyText(code); }; }