> I was told ...
Note: It is generally better to reply to the message, rather than start a
new thread. That makes it easier for people to follow the conversation.
I would have also seen this message and replied earlier, since my
newsreader will highlight replies to my messages.
> I should remove the Ctrl-Up key binding from the JTabbedPane's InputMap
> using WHEN_ANCESTOR_OF_FOCUSED_COMPONENT. But I'm not sure how do to
> this, nor which component this should be done to.
I first suggested removing the key binding, but now that I think about it,
you probably do not want to do that. All InputMaps have a (possibly null)
parent InputMap. The look-and-feel sets up an InputMap for each component
class and then each component instance gets an InputMap which has the
class InputMap as a parent.
You could remove the binding from the class InputMap, but that would
affect every JTabbedPane in the JVM, so that is not a good idea. And you
cannot remove the binding from your tabbed pane's InputMap, since it is
not there in the first place. But you can add a new binding to the
component's map, which will supersede the definition in the parent map.
An InputMap maps a KeyStroke to an "actionMapKey", which is then used to
look up the action for the keystroke in the ActionMap. So all you need to
do in order to "unbind" the KeyStroke is to map it to an actionMapKey that
does not exist, such as "DoNothing":
InputMap map = tabbedPane.getInputMap(
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
KeyStroke keyStroke = KeyStroke.getKeyStroke(
KeyEvent.VK_UP, InputEvent.CTRL_MASK, false );
map.put( keyStroke, "DoNothing" );

Signature
Regards,
John McGrath
wizumwalt - 16 Feb 2005 02:14 GMT
>>I was told ...
>
> Note: It is generally better to reply to the message, rather than start a
> new thread. That makes it easier for people to follow the conversation.
> I would have also seen this message and replied earlier, since my
> newsreader will highlight replies to my messages.
Apologies, and thank you very much for this help. That did it.
>>I should remove the Ctrl-Up key binding from the JTabbedPane's InputMap
>>using WHEN_ANCESTOR_OF_FOCUSED_COMPONENT. But I'm not sure how do to
[quoted text clipped - 22 lines]
> KeyEvent.VK_UP, InputEvent.CTRL_MASK, false );
> map.put( keyStroke, "DoNothing" );