or should I use a lot of switches and IFs
Perhaps you can just put them in a lookup table , i.e. put Java KeyCodes in a large array, so you just have to do it javaKeyCode = keyLut[cppScanCode].
One list of scan codes can be found here , but VK_KEYCODESyou can, of course, be found in the docs API forKeyEvent .
Java is designed to be platform independent, so for example, left-clicking will always give VK_LEFT, regardless of the scan code. I'm not quite sure, but I suggest that C ++ - scancode is hardware dependent.
source
share