How can I handle an alt graph keystroke?
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), ...
开发者_如何学Python
but the action is never triggered. If I replace altGraph with alt it works.
What can I do to make it work?
If it matters: I'm using Java 6 and Windows.
Did you try
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.ALT_GRAPH_DOWN_MASK)
?
精彩评论