views:

41

answers:

1

I want to add a keyboard binding to a JTextField, but I cannot make it work using the alt graph key.

I followed the keyboard bindings tutorial and tried this:

    inputMap.put(KeyStroke.getKeyStroke("altGraph ENTER"), ...
    inputMap.put(getKeyStroke(KeyEvent.VK_O, InputEvent.ALT_GRAPH_DOWN_MASK), ...

but the action is never triggered. If I replace "alt graph" with "alt" it works.

What can I do to make it work?

If it matters: I'm using the Java 6 and Windows.

A: 

Did you try

KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_GRAPH_DOWN_MASK)

?

Fortega
Yes, I did. In my tests I later tried with the letter "O" to make sure, altgr+enter is not a special case.
DR