Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
8, 11, 17, 18, 19
-
b17
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8289118 | 17.0.5-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8289459 | 17.0.5 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8295137 | 11.0.18 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8289194 | 11.0.17-oracle | Dukebot | P4 | Resolved | Fixed | b01 |
JDK-8289430 | 8u351 | Dukebot | P4 | Resolved | Fixed | b01 |
Description
Issue:
In the following example (and similarly with other components) you cannot specify the correct character to underline:
JLabel label = new JLabel ("Save As...");
label.setDisplayedMnemonic ('A');
The 'A' in 'As' should be underlined (that's the intention at least), but the 'a' in 'Save' is what gets underlined.
The problem (aside from the lack of an API to specify exactly what should be underlined) is in the javax.swing.plaf.basic.BasicGraphicUtils drawString method which underlines the first character (upper OR lowercase) that matches the mnemonic character.
Fix:
A new property "displayedMnemonicIndex" is introduced
in classes AbstractButton and JLabel. It tells which
character to underline. So for example to underline
the capital 'A' in 'Save As', one should call:
setMnemonic('A');
setDisplayedMnemonicIndex(5);
Testing:
Tested in Mach5 10 times per platform and got all Pass.
Attachments
Issue Links
- backported by
-
JDK-8289118 Create an automated regression test for RFE 4138746
-
- Resolved
-
-
JDK-8289194 Create an automated regression test for RFE 4138746
-
- Resolved
-
-
JDK-8289430 Create an automated regression test for RFE 4138746
-
- Resolved
-
-
JDK-8289459 Create an automated regression test for RFE 4138746
-
- Resolved
-
-
JDK-8295137 Create an automated regression test for RFE 4138746
-
- Resolved
-
- relates to
-
JDK-4138746 SetMnemonic should be case-sensitive
-
- Resolved
-
- links to
-
Commit openjdk/jdk11u-dev/01cc71f3
-
Commit openjdk/jdk17u-dev/23fc8605
-
Commit openjdk/jdk/0a67d686
-
Review openjdk/jdk11u-dev/1423
-
Review openjdk/jdk17u-dev/512
-
Review openjdk/jdk/8093