I'm pressing the AltGr key in my Java application, but instead of receiving a KeyEvent with key code VK_ALT_GRAPH I get two events. The first with key code VK_CONTROL and the second with VK_ALT.
Is this the correct behaviour?
Using Java 7 on Windows 7. Can be reproduced with the demo app found on http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html
When I press AltGr it reports:
KEY PRESSED: key code = 17 (Ctrl) extended modifiers = 128 (Ctrl) action key? NO key location: left KEY PRESSED: key code = 18 (Alt) extended modifiers = 640 (Ctrl+Alt) action key? NO key location: right KEY RELEASED: key code = 17 (Ctrl) extended modifiers = 512 (Alt) action key? NO key location: left KEY RELEASED: key code = 18 (Alt) extended modifiers = 0 (no extended modifiers) action key? NO key location: right
in windows, AltGr and Ctrl+Alt are Synonyms. in some locales(keyboard layouts?, they are both treated as Ctrl+Alt, in others, they are both treated as AltGr. However, I am not completely sure.
See http://msdn.microsoft.com/en-us/library/windows/desktop/aa511502.aspx and use Ctrl-F to find AltGr.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With