• Post Reply Bookmark Topic Watch Topic
  • New Topic

KeyEvent Virtual Keys  RSS feed

saager mhatre
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other day I was trying to set up the InputMap for my app and ran into some 'strange looking' behaviour.
I needed to map to the + and - keys but didn't want to use the KeyStroke.getKeystroke(char) factory method. I had decided on the KeyStroke.getKeystroke(keyCode, modifiers) method.
So I went ahead and mapped my action key to KeyEvent.VK_PLUS & VK_MINUS key codes. But, when I ran the app the action refused to fire. On further investigation, I realized that the corect mappingwas to the KeyEvent.VK_ADD & KeyEvent.VK_SUBTRACT key codes.
What I would like to know is why we seem to have seemingly duplicate codes in the KeyEvent class.
What keys do the KeyEvent.VK_PLUS & KeyEvent.VK_MINUS codes map to?
[ May 24, 2004: Message edited by: saager mhatre ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!