How to deal with international keyboard layouts?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to deal with international keyboard layouts?

Schred
While in the process of creating an undo/redo system, I discovered that the 'z' key on my keyboard corresponded to the 'y' keycode in the newt KeyEvent, and the other way around (so typing 'z' results in a keycode of 89 eventhough it's specified as 90, and 'y' is the same but in reverse).
This is probably due to the different layout of my German keyboard, since when I switched it to the American one, the problem was fixed.
That wouldn't be too bad as I could just use the getKeyChar() method to get the corresponding character, but in combination with keys like control this doesn't work either.

How do I fix this?
Reply | Threaded
Open this post in threaded view
|

Re: How to deal with international keyboard layouts?

Schred
Ah, event.getKeySymbol() seems to work.
Reply | Threaded
Open this post in threaded view
|

Re: How to deal with international keyboard layouts?

gouessej
Administrator
In reply to this post by Schred
I don't reproduce this bug on an AZERTY keyboard and it's strange because I assume that Sven has at least one QWERTZ keyboard. Please fill a bug report.

Read carefully the Java documentation of getKeyCode() as it uses the US keyboard layout. getKeySymbol() doesn't :)
Julien Gouesse | Personal blog | Website