JDK-8284294 : Create an automated regression test for RFE 4138746
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,11,17,18,19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-04-04
  • Updated: 2022-10-11
  • Resolved: 2022-04-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 19 JDK 8
11.0.17-oracleFixed 17.0.5-oracleFixed 19 b17Fixed 8u351Fixed
Related Reports
Relates :  
Description
Create an automated regression test for 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.
Comments
Fix request [11u] I backport this for parity with 11.0.17-oracle. No risk, only a test change. Clean backport. Test passes. SAP nighlty testing passed.
11-10-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/1423 Date: 2022-10-10 06:46:10 +0000
10-10-2022

Fix request [17u] I backport this for parity with 17.0.5-oracle. No risk, only a test change. Clean backport. Test passes. SAP nighlty testing passed.
28-06-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk17u-dev/pull/512 Date: 2022-06-27 14:45:19 +0000
27-06-2022

Changeset: 0a67d686 Author: Manukumar V S <mvs@openjdk.org> Committer: Abdul Kolarkunnu <akolarkunnu@openjdk.org> Date: 2022-04-06 07:21:33 +0000 URL: https://git.openjdk.java.net/jdk/commit/0a67d686709000581e29440ef13324d1f2eba9ff
06-04-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8093 Date: 2022-04-04 14:05:14 +0000
04-04-2022