GetKeyCode() Always Returns 0
r6dev opened this issue · 5 comments
Whenever I call e
.getKeyCode() I always get '0' in return, so I can not use NativeKeyEvent
.getKeyText() or anything that utilizes the this
.keyCode variable. Is there any fix to this?
Use KeyTyped events? Do you mean something separate from what I'm already using?
And by that I mean I am already using a nativeKeyTyped event, yet it still returns 0
Key Typed events produce characters and press/release events produce codes. So if you are listening for key typed, use e.getKeyChar()
to get the ASCII representation that was produced. Key down events are fired fight before key typed events and use e.getKeyCode()
to get the key code which may or may not be the same as the ASCII char. This should be the same as how key events work in Java.
Wow thank you so much, the problem is fixed now