On Mon, 4 Apr 2022 14:05:14 GMT, Manukumar V S <m...@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.

This pull request has now been integrated.

Changeset: 0a67d686
Author:    Manukumar V S <m...@openjdk.org>
Committer: Abdul Kolarkunnu <akolarku...@openjdk.org>
URL:       
https://git.openjdk.java.net/jdk/commit/0a67d686709000581e29440ef13324d1f2eba9ff
Stats:     233 lines in 1 file changed: 233 ins; 0 del; 0 mod

8284294: Create an automated regression test for RFE 4138746

Reviewed-by: serb

-------------

PR: https://git.openjdk.java.net/jdk/pull/8093

Reply via email to