kwhat/jnativehook

"Key Typed: Undefined", but the pressed and release events are properly detected.

QazCetelic opened this issue · 3 comments

When using the GlobalKeyListenerExample, and typing hello, these are the results. I'm guessing something isn't working right that detects the typed keys.

Key Pressed: H
Key Typed: Undefined
Key Pressed: E
Key Typed: Undefined
Key Released: H
Key Released: E
Key Pressed: L
Key Typed: Undefined
Key Released: L
Key Pressed: L
Key Typed: Undefined
Key Released: L
Key Pressed: O
Key Typed: Undefined
Key Released: O
kwhat commented

What code is producing this and on what operating system? I am guessing you are doing something like NativeKeyEvent.getKeyText(e.getKeyCode()) which is working as intended for key typed events because they produce a keycode of VC_UNDEFINED. This is the same behavior as AWT.

I misunderstood how key events work.

kwhat commented

You probably want e.getKeyChar(); for key typed events.