• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Detect AltGr key?

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Is it possible to detect the AltGr (right alt) key from Java?

Running this program with JRE 1.6.0_15 on Windows XP gives two codes when AltGr is pressed: CTRL and ALT
KeyEvent.isAltGraphDown() always returns false.

The program is http://java.sun.com/docs/books/tutorialJWS/uiswing/events/ex6/KeyEventDemo.jnlp

Note: US keyboard layout generates ALT code when the right alt is pressed. Switch the OS keyboard layout setting to German or Slovenian.


I wonder, as currently AltGr appears to be detected as ctrl+alt. That gives problems in Eclipse, because this happens:
(keyboard layout is set to "Slovenian")
- user presses AltGr+W in editor to get the pipe "|" character (this normally works in other non-java programs)
- Eclipse/Java sees ctrl-alt-W
- Eclipse uses the shortcut defined for ctrl-alt-W (mapped to show SVN properties view)
- "|" does not appears in editor

Ideally the ctrl,alt and W keys would trigger that SVN property, while AltGr,W would type |.

Using that test program above gives the impression the Java programs can not detect in the ctrl+alt code comes from those both keys or from the AltGr key.
Or is there a way?

Regards,
David
 
I think he's gonna try to grab my monkey. Do we have a monkey outfit for this tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic