|
Description
|
FULL PRODUCT VERSION :
java version "1.4.1_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
FULL OS VERSION :
Windows NT Version 4.0
A DESCRIPTION OF THE PROBLEM :
Mnemonics for a JTabbedPane is currently defined in the input map for
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT. Is should be defined in the
input map for WHEN_IN_FOCUSED_WINDOW.
The reason for this is that if a mnemonic is rendered (i.e. underlined) the
user expectation is that Alt mnemonic key will activate the mnemonic regardless of where focus is in the window (whethen in the TabbedPane or not).
The fix for this is to change initMnemonics in BasicTabbedPaneUI to:
private void initMnemonics() {
mnemonicToIndexMap = new Hashtable();
mnemonicInputMap = new ComponentInputMapUIResource(tabPane);
InputMap parent = SwingUtilities.getUIInputMap(listTabbedPane,
JComponent.WHEN_IN_FOCUSED_WINDOW);
mnemonicInputMap.setParent(parent);
SwingUtilities.replaceUIInputMap(listTabbedPane,
JComponent.WHEN_IN_FOCUSED_WINDOW,
mnemonicInputMap);
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Define a JTabbedPane with a mnemonic in a panel with another focusable component
(such as JButton) as a sibling to the JTabbedPane. Then when running,
mnemonics do not work if the other focusable component has focus.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Alt-mnemonic to work even sibling components of the tab pane has focus
ACTUAL -
they dont
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 192634)
======================================================================
|