Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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
 
Something must be done about this. Let's start by reading this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic