RFR: 8284294: Create an automated regression test for RFE 4138746
Sergey Bylokhov
serb at openjdk.java.net
Wed Apr 6 05:33:40 UTC 2022
On Mon, 4 Apr 2022 14:05:14 GMT, Manukumar V S <mvs at openjdk.org> wrote:
> Create an automated regression test for [JDK-4138746](https://bugs.openjdk.java.net/browse/JDK-4138746)
>
> 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.
Marked as reviewed by serb (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8093
More information about the client-libs-dev
mailing list