Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable catching JMeniItem accelerators

 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I've got an editable JTable. When a cell in that table is selected (a normal textfield) and the user uses an accelerator from my menu (eg CTRL-M), the action associated with that accelerated and menuitem is executed, but the editor from the selected cell starts..

Is there a way I can tell the JTable (or the used cell editors) not to respond to CTRL-something ?

I tried adding the KeyEvents to the input map of the JTable (with "none" as action) but that didn't help..

Thanks!
 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's also another strange thing happening..

I'm using JTextFields for editing the cells.. but I've overriden the method processFocusEvent so that if the editing starts, all of the text is selected, like this:


This works like a charm when I double click on a cell, or press a singe key (eg D)..
But, when I press a key combination (eg CTRL-D), the event from the JMenuItem associated with this keyevent is started, the cell is being edited, but no text is selected...

this makes me think that there is a different way in how a JTable (or the celleditor handler) handles normal keypresses and combinations..

Anyone who can help me?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic