So I built a little util class to convert jfx to jme (lwjgl3) key codes.
import java.util.HashMap;
public class JfxJmeKeyCodeXRef {
public static HashMap<Integer, Integer> xref = new HashMap<Integer, Integer>();
static {
xref.put(0, //JFX "Undefined"
0x00); //JME"KEY_UNKNOWN"
xref.put(27, //JFX "Esc"
0x01); //JME"KEY_ESCAPE"
xref.put(49, //JFX "1"
0x02); //JME"KEY_1"
xref.put(50, //JFX "2"
0x03); //JME"KEY_2"
xref.put(51, //3"
0x04); //JME"KEY_3"
xref.put(52, //JFX "4"
0x05); //JME"KEY_4"
xref.put(53, //JFX "5"
0x06); //JME"KEY_5"
xref.put(54, //JFX "6"
0x07); //JME"KEY_6"
xref.put(55, //JFX "7"
0x08); //JME"KEY_7"
xref.put(56, //JFX "8"
0x09); //JME"KEY_8"
xref.put(57, //JFX "9"
0x0A); //JME"KEY_9"
xref.put(48, //JFX "0"
0x0B); //JME"KEY_0"
xref.put(45, //JFX "Minus"
0x0C); //JME"KEY_MINUS"
xref.put(61, //JFX "Equals"
0x0D); //JME"KEY_EQUALS"
xref.put(8, //JFX "Backspace"
0x0E); //JME"KEY_BACK"
xref.put(9, //JFX "Tab"
0x0F); //JME"KEY_TAB"
xref.put(81, //JFX "Q"
0x10); //JME"KEY_Q"
xref.put(87, //JFX "W"
0x11); //JME"KEY_W"
xref.put(69, //JFX "E"
0x12); //JME"KEY_E"
xref.put(82, //JFX "R"
0x13); //JME"KEY_R"
xref.put(84, //JFX "T"
0x14); //JME"KEY_T"
xref.put(89, //JFX "Y"
0x15); //JME"KEY_Y"
xref.put(85, //JFX "U"
0x16); //JME"KEY_U"
xref.put(73, //JFX "I"
0x17); //JME"KEY_I"
xref.put(79, //JFX "O"
0x18); //JME"KEY_O"
xref.put(80, //JFX "P"
0x19); //JME"KEY_P"
xref.put(91, //JFX "Open Bracket"
0x1A); //JME"KEY_LBRACKET"
xref.put(93, //JFX "Close Bracket"
0x1B); //JME"KEY_RBRACKET"
xref.put(10, //JFX "Enter"
0x1C); //JME"KEY_RETURN"
xref.put(17, //JFX "Ctrl"
0x1D); //JME"KEY_LCONTROL"
xref.put(65, //JFX "A"
0x1E); //JME"KEY_A"
xref.put(83, //JFX "S"
0x1F); //JME"KEY_S"
xref.put(68, //JFX "D"
0x20); //JME"KEY_D"
xref.put(70, //JFX "F"
0x21); //JME"KEY_F"
xref.put(71, //JFX "G"
0x22); //JME"KEY_G"
xref.put(72, //JFX "H"
0x23); //JME"KEY_H"
xref.put(74, //JFX "J"
0x24); //JME"KEY_J"
xref.put(75, //JFX "K"
0x25); //JME"KEY_K"
xref.put(76, //JFX "L"
0x26); //JME"KEY_L"
xref.put(59, //JFX "Semicolon"
0x27); //JME"KEY_SEMICOLON"
xref.put(222, //JFX "Quote"
0x28); //JME"KEY_APOSTROPHE"
xref.put(192, //JFX "Back Quote"
0x29); //JME"KEY_GRAVE"
xref.put(16, //JFX "Shift"
0x2A); //JME"KEY_LSHIFT"
xref.put(92, //JFX "Back Slash"
0x2B); //JME"KEY_BACKSLASH"
xref.put(90, //JFX "Z"
0x2C); //JME"KEY_Z"
xref.put(88, //JFX "X"
0x2D); //JME"KEY_X"
xref.put(67, //JFX "C"
0x2E); //JME"KEY_C"
xref.put(86, //JFX "V"
0x2F); //JME"KEY_V"
xref.put(66, //JFX "B"
0x30); //JME"KEY_B"
xref.put(78, //JFX "N"
0x31); //JME"KEY_N"
xref.put(77, //JFX "M"
0x32); //JME"KEY_M"
xref.put(44, //JFX "Comma"
0x33); //JME"KEY_COMMA"
xref.put(46, //JFX "Period"
0x34); //JME"KEY_PERIOD"
xref.put(47, //JFX "Slash"
0x35); //JME"KEY_SLASH"
xref.put(16, //JFX "Shift"
0x36); //JME"KEY_RSHIFT"
xref.put(106, //JFX "Multiply"
0x37); //JME"KEY_MULTIPLY"
xref.put(525, //JFX "Context Menu"
0x38); //JME"KEY_LMENU"
xref.put(32, //JFX "Space"
0x39); //JME"KEY_SPACE"
xref.put(20, //JFX "Caps Lock"
0x3A); //JME"KEY_CAPITAL"
xref.put(112, //JFX "F1"
0x3B); //JME"KEY_F1"
xref.put(113, //JFX "F2"
0x3C); //JME"KEY_F2"
xref.put(114, //JFX "F3"
0x3D); //JME"KEY_F3"
xref.put(115, //JFX "F4"
0x3E); //JME"KEY_F4"
xref.put(116, //JFX "F5"
0x3F); //JME"KEY_F5"
xref.put(117, //JFX "F6"
0x40); //JME"KEY_F6"
xref.put(118, //JFX "F7"
0x41); //JME"KEY_F7"
xref.put(119, //JFX "F8"
0x42); //JME"KEY_F8"
xref.put(120, //JFX "F9"
0x43); //JME"KEY_F9"
xref.put(121, //JFX "F10"
0x44); //JME"KEY_F10"
xref.put(144, //JFX "Num Lock"
0x45); //JME"KEY_NUMLOCK"
xref.put(145, //JFX "Scroll Lock"
0x46); //JME"KEY_SCROLL"
xref.put(103, //JFX "Numpad 7"
0x47); //JME"KEY_NUMPAD7"
xref.put(104, //JFX "Numpad 8"
0x48); //JME"KEY_NUMPAD8"
xref.put(105, //JFX "Numpad 9"
0x49); //JME"KEY_NUMPAD9"
xref.put(109, //JFX "Subtract"
0x4A); //JME"KEY_SUBTRACT"
xref.put(100, //JFX "Numpad 4"
0x4B); //JME"KEY_NUMPAD4"
xref.put(101, //JFX "Numpad 5"
0x4C); //JME"KEY_NUMPAD5"
xref.put(102, //JFX "Numpad 6"
0x4D); //JME"KEY_NUMPAD6"
xref.put(107, //JFX "Add"
0x4E); //JME"KEY_ADD"
xref.put(97, //JFX "Numpad 1"
0x4F); //JME"KEY_NUMPAD1"
xref.put(98, //JFX "Numpad 2"
0x50); //JME"KEY_NUMPAD2"
xref.put(99, //JFX "Numpad 3"
0x51); //JME"KEY_NUMPAD3"
xref.put(96, //JFX "Numpad 0"
0x52); //JME"KEY_NUMPAD0"
xref.put(110, //JFX "Decimal"
0x53); //JME"KEY_DECIMAL"
xref.put(122, //JFX "F11"
0x57); //JME"KEY_F11"
xref.put(123, //JFX "F12"
0x58); //JME"KEY_F12"
xref.put(61440, //JFX "F13"
0x64); //JME"KEY_F13"
xref.put(61441, //JFX "F14"
0x65); //JME"KEY_F14"
xref.put(61442, //JFX "F15"
0x66); //JME"KEY_F15"
xref.put(21, //JFX "Kana"
0x70); //JME"KEY_KANA"
xref.put(28, //JFX "Convert"
0x79); //JME"KEY_CONVERT"
xref.put(29, //JFX "Nonconvert"
0x7B); //JME"KEY_NOCONVERT"
xref.put(61, //JFX "Equals"
0x8D); //JME"KEY_NUMPADEQUALS"
xref.put(514, //JFX "Circumflex"
0x90); //JME"KEY_CIRCUMFLEX"
xref.put(512, //JFX "At"
0x91); //JME"KEY_AT"
xref.put(513, //JFX "Colon"
0x92); //JME"KEY_COLON"
xref.put(523, //JFX "Underscore"
0x93); //JME"KEY_UNDERLINE"
xref.put(25, //JFX "Kanji"
0x94); //JME"KEY_KANJI"
xref.put(65480, //JFX "Stop"
0x95); //JME"KEY_STOP"
xref.put(154, //JFX "Print Screen"
0x9A); //JME"KEY_PRTSCR"
xref.put(10, //JFX "Enter"
0x9C); //JME"KEY_NUMPADENTER"
xref.put(17, //JFX "Ctrl"
0x9D); //JME"KEY_RCONTROL"
xref.put(44, //JFX "Comma"
0xB3); //JME"KEY_NUMPADCOMMA"
xref.put(111, //JFX "Divide"
0xB5); //JME"KEY_DIVIDE"
xref.put(525, //JFX "Context Menu"
0xB8); //JME"KEY_RMENU"
xref.put(19, //JFX "Pause"
0xC5); //JME"KEY_PAUSE"
xref.put(36, //JFX "Home"
0xC7); //JME"KEY_HOME"
xref.put(38, //JFX "Up"
0xC8); //JME"KEY_UP"
xref.put(33, //JFX "Page Up"
0xC9); //JME"KEY_PRIOR"
xref.put(37, //JFX "Left"
0xCB); //JME"KEY_LEFT"
xref.put(39, //JFX "Right"
0xCD); //JME"KEY_RIGHT"
xref.put(35, //JFX "End"
0xCF); //JME"KEY_END"
xref.put(40, //JFX "Down"
0xD0); //JME"KEY_DOWN"
xref.put(34, //JFX "Page Down"
0xD1); //JME"KEY_NEXT"
xref.put(155, //JFX "Insert"
0xD2); //JME"KEY_INSERT"
xref.put(127, //JFX "Delete"
0xD3); //JME"KEY_DELETE"
xref.put(157, //JFX "Meta"
0xDB); //JME"KEY_LMETA "
xref.put(157, //JFX "Meta"
0xDC); //JME"KEY_RMETA"
xref.put(409, //JFX "Power"
0xDE); //JME"KEY_POWER"
}
public static int JfxToJmeKeyCode(int jfxKeyCode) {
return xref.get(jfxKeyCode);
}
}
There were some key codes I did not know, and some things like the ‘shift’ versions of the keys that jme and jfx handle different. Jfx has a different key code for those, and I excluded that.
Complete list of key codes not included here:
JFX:
CANCEL(3, "Cancel"),
CLEAR(12, "Clear"),
ALT(18, "Alt", 8),
SEPARATOR(108, "Separator"),
F16(61443, "F16", 1),
F17(61444, "F17", 1),
F18(61445, "F18", 1),
F19(61446, "F19", 1),
F20(61447, "F20", 1),
F21(61448, "F21", 1),
F22(61449, "F22", 1),
F23(61450, "F23", 1),
F24(61451, "F24", 1),
HELP(156, "Help"),
KP_UP(224, "Numpad Up", 70),
KP_DOWN(225, "Numpad Down", 70),
KP_LEFT(226, "Numpad Left", 70),
KP_RIGHT(227, "Numpad Right", 70),
DEAD_GRAVE(128, "Dead Grave"),
DEAD_ACUTE(129, "Dead Acute"),
DEAD_CIRCUMFLEX(130, "Dead Circumflex"),
DEAD_TILDE(131, "Dead Tilde"),
DEAD_MACRON(132, "Dead Macron"),
DEAD_BREVE(133, "Dead Breve"),
DEAD_ABOVEDOT(134, "Dead Abovedot"),
DEAD_DIAERESIS(135, "Dead Diaeresis"),
DEAD_ABOVERING(136, "Dead Abovering"),
DEAD_DOUBLEACUTE(137, "Dead Doubleacute"),
DEAD_CARON(138, "Dead Caron"),
DEAD_CEDILLA(139, "Dead Cedilla"),
DEAD_OGONEK(140, "Dead Ogonek"),
DEAD_IOTA(141, "Dead Iota"),
DEAD_VOICED_SOUND(142, "Dead Voiced Sound"),
DEAD_SEMIVOICED_SOUND(143, "Dead Semivoiced Sound"),
AMPERSAND(150, "Ampersand"),
ASTERISK(151, "Asterisk"),
QUOTEDBL(152, "Double Quote"),
LESS(153, "Less"),
GREATER(160, "Greater"),
BRACELEFT(161, "Left Brace"),
BRACERIGHT(162, "Right Brace"),
DOLLAR(515, "Dollar"),
EURO_SIGN(516, "Euro Sign"),
EXCLAMATION_MARK(517, "Exclamation Mark"),
INVERTED_EXCLAMATION_MARK(518, "Inverted Exclamation Mark"),
LEFT_PARENTHESIS(519, "Left Parenthesis"),
NUMBER_SIGN(520, "Number Sign"),
PLUS(521, "Plus"),
RIGHT_PARENTHESIS(522, "Right Parenthesis"),
FINAL(24, "Final"),
ACCEPT(30, "Accept"),
MODECHANGE(31, "Mode Change"),
ALPHANUMERIC(240, "Alphanumeric"),
KATAKANA(241, "Katakana"),
HIRAGANA(242, "Hiragana"),
FULL_WIDTH(243, "Full Width"),
HALF_WIDTH(244, "Half Width"),
ROMAN_CHARACTERS(245, "Roman Characters"),
ALL_CANDIDATES(256, "All Candidates"),
PREVIOUS_CANDIDATE(257, "Previous Candidate"),
CODE_INPUT(258, "Code Input"),
JAPANESE_KATAKANA(259, "Japanese Katakana"),
JAPANESE_HIRAGANA(260, "Japanese Hiragana"),
JAPANESE_ROMAN(261, "Japanese Roman"),
KANA_LOCK(262, "Kana Lock"),
INPUT_METHOD_ON_OFF(263, "Input Method On/Off"),
CUT(65489, "Cut"),
COPY(65485, "Copy"),
PASTE(65487, "Paste"),
UNDO(65483, "Undo"),
AGAIN(65481, "Again"),
FIND(65488, "Find"),
PROPS(65482, "Properties"),
COMPOSE(65312, "Compose"),
ALT_GRAPH(65406, "Alt Graph", 8),
BEGIN(65368, "Begin"),
SOFTKEY_0(4096, "Softkey 0"),
SOFTKEY_1(4097, "Softkey 1"),
SOFTKEY_2(4098, "Softkey 2"),
SOFTKEY_3(4099, "Softkey 3"),
SOFTKEY_4(4100, "Softkey 4"),
SOFTKEY_5(4101, "Softkey 5"),
SOFTKEY_6(4102, "Softkey 6"),
SOFTKEY_7(4103, "Softkey 7"),
SOFTKEY_8(4104, "Softkey 8"),
SOFTKEY_9(4105, "Softkey 9"),
GAME_A(4106, "Game A"),
GAME_B(4107, "Game B"),
GAME_C(4108, "Game C"),
GAME_D(4109, "Game D"),
STAR(4110, "Star"),
POUND(4111, "Pound"),
INFO(457, "Info"),
COLORED_KEY_0(403, "Colored Key 0"),
COLORED_KEY_1(404, "Colored Key 1"),
COLORED_KEY_2(405, "Colored Key 2"),
COLORED_KEY_3(406, "Colored Key 3"),
EJECT_TOGGLE(414, "Eject", 256),
PLAY(415, "Play", 256),
RECORD(416, "Record", 256),
FAST_FWD(417, "Fast Forward", 256),
REWIND(412, "Rewind", 256),
TRACK_PREV(424, "Previous Track", 256),
TRACK_NEXT(425, "Next Track", 256),
CHANNEL_UP(427, "Channel Up", 256),
CHANNEL_DOWN(428, "Channel Down", 256),
VOLUME_UP(447, "Volume Up", 256),
VOLUME_DOWN(448, "Volume Down", 256),
MUTE(449, "Mute", 256),
COMMAND(768, "Command", 8),
SHORTCUT(-1, "Shortcut");
JME:
public static final int KEY_YEN = 0x7D;
public static final int KEY_AX = 0x96;
public static final int KEY_UNLABELED = 0x97;
public static final int KEY_SYSRQ = 0xB7;
public static final int KEY_APPS = 0xDD;
public static final int KEY_SLEEP = 0xDF;
public static final int KEY_LAST = 0xE0;
Feel free to use how ever you like, I just ask that if you make improvements, or find issues/fix anything, that you share it here.
Thanks,
Trevor