protected byte[] getAnsiKeyCode(KeyEvent e, KeyMode cursorMode, KeyMode keypadMode) {
		if (e.getModifiersEx() != 0) {
			return getModifiedAnsiKeyCode(e);
		}
		return switch (e.getKeyCode()) {
			case KeyEvent.VK_INSERT -> CODE_INSERT;
			// NB. CODE_DELETE is handled in keyTyped
			// Yes, HOME and END are considered CURSOR keys
			case KeyEvent.VK_HOME -> cursorMode.choose(CODE_HOME_NORMAL, CODE_HOME_APPLICATION);
			case KeyEvent.VK_END -> cursorMode.choose(CODE_END_NORMAL, CODE_END_APPLICATION);
			case KeyEvent.VK_PAGE_UP -> CODE_PAGE_UP;
			case KeyEvent.VK_PAGE_DOWN -> CODE_PAGE_DOWN;
			case KeyEvent.VK_NUMPAD5 -> CODE_NUMPAD5;
			case KeyEvent.VK_UP -> cursorMode.choose(CODE_UP_NORMAL, CODE_UP_APPLICATION);
			case KeyEvent.VK_DOWN -> cursorMode.choose(CODE_DOWN_NORMAL, CODE_DOWN_APPLICATION);
			case KeyEvent.VK_RIGHT -> cursorMode.choose(CODE_RIGHT_NORMAL, CODE_RIGHT_APPLICATION);
			case KeyEvent.VK_LEFT -> cursorMode.choose(CODE_LEFT_NORMAL, CODE_LEFT_APPLICATION);
			case KeyEvent.VK_F1 -> CODE_F1;
			case KeyEvent.VK_F2 -> CODE_F2;
			case KeyEvent.VK_F3 -> CODE_F3;
			case KeyEvent.VK_F4 -> CODE_F4;
			case KeyEvent.VK_F5 -> CODE_F5;
			case KeyEvent.VK_F6 -> CODE_F6;
			case KeyEvent.VK_F7 -> CODE_F7;
			case KeyEvent.VK_F8 -> CODE_F8;
			case KeyEvent.VK_F9 -> CODE_F9;
			case KeyEvent.VK_F10 -> CODE_F10;
			case KeyEvent.VK_F11 -> CODE_F11;
			case KeyEvent.VK_F12 -> CODE_F12;
			case KeyEvent.VK_F13 -> CODE_F13;
			case KeyEvent.VK_F14 -> CODE_F14;
			case KeyEvent.VK_F15 -> CODE_F15;
			case KeyEvent.VK_F16 -> CODE_F16;
			case KeyEvent.VK_F17 -> CODE_F17;
			case KeyEvent.VK_F18 -> CODE_F18;
			case KeyEvent.VK_F19 -> CODE_F19;
			case KeyEvent.VK_F20 -> CODE_F20;
			// F21-F24 are not given on Wikipedia...
			default -> CODE_NONE;
		};
	}
An encoder which can translate AWT/Swing events into ANSI input codes.

<p>
The input system is not as well decoupled from Swing as the output system. For ease of use, the
methods are named the same as their corresponding Swing event listener methods, though they may
require additional arguments. These in turn invoke the {@link #generateBytes(ByteBuffer)} method,
which the implementor must send to the appropriate recipient, usually a pty.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/terminal/TerminalAwtEventEncoder.java