views:

36

answers:

1

It looks like native applications behave differently if the user presses the Return key (right to the characters) or the Enter key (number key pad) - one time a new line character is inserted, the other time the default button is activated.

How I can distinguish both key presses from Java/AWT/Swing?

+1  A: 
keyEvent.getKeyLocation() == KeyEvent.KEY_LOCATION_NUMPAD
Gunslinger47
Thanks. Unfortunately, this is not handled by KeyStroke, so one can't assign different actions for the Enter or Return key. :(
mklhmnn