• Post Reply Bookmark Topic Watch Topic
  • New Topic

Key accelerator steals focus from textFields?  RSS feed

 
Johann Dobbins
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I set a key accelerator for a JMenuItem, and type that accelerator in a textfield, the typing gets outputted to the textfield and then the key accelerator occurs. For example, if I set shift+c as a key accelerator, then type shift+c in a textfield, I will get a capital 'C' in the textfield and the associated JMenuItem action will occur. Are there any parameters that I can use when setting this accelerator or any workaround I can use to prevent the accelerator from occurring and the textfield from losing focuses? I would rather not have to implement a workaround involving listeners for the textfield, because this would would require refactoring all code pertaining to textfields in my app.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it's a bad idea to use Shift with anything that can usually be typed - such as letters and digits. I uninstalled the IE Developer Toolbar just for this reason - it intercepted Shift+R all the time, and it was annoying as hell.

Shift should only be used in combination with the function keys or with Ctrl / Alt as additional meta keys.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!