This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JTable catching JMeniItem accelerators Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable catching JMeniItem accelerators" Watch "JTable catching JMeniItem accelerators" New topic
Author

JTable catching JMeniItem accelerators

Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
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

Joined: Mar 12, 2004
Posts: 81
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable catching JMeniItem accelerators
 
Similar Threads
data transfer for JTable
JTable
MultipleCell Selection in JTable
JTable
jtable