• 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
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

KeyEvent Virtual Keys

 
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 ]
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic