JDK-8068527 : Mnemonic shortcut not displaying on tool tip
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6,7,8,9,10
  • Priority: P3
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-01-05
  • Updated: 2017-07-05
  • Resolved: 2017-07-05
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.
Other
tbd_majorResolved
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 64 bit

A DESCRIPTION OF THE PROBLEM :
I have configured a set toolTip to  a button in Swing, there i have also configured a setMnemonic short cut to the same button,
in java 5 it was working fine but in java 7 the short cut is not display on tool tip in java 7 64 bit.


This was working fine in java 5 but not working in java 7 64 bit 

ADDITIONAL REGRESSION INFORMATION: 
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
In swing 
JButton jbx=new JButton();
jbx.setMnemonic(KeyEvent.VK_A);
jbx.setToolTip("it is button")

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
the mnemonic shortcut should display when cursor moving on to the button

ACTUAL -
the mnemonic shortcut should display when cursor moving on to the button
it displays only the tool top text

ERROR MESSAGES/STACK TRACES THAT OCCUR :
no error message

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
In swing 
JButton jbx=new JButton();
jbx.setMnemonic(KeyEvent.VK_A);
jbx.setToolTip("it is button")
---------- END SOURCE ----------

SUPPORT :
YES


Comments
Mnemonic shortcut is intentionally not displayed in tooltip from jdk6. As per fix in JDK-5047379, HTML tooltips have been fixed such that the shortcut key/accelerator is now being painted. Additionally, it was determined that it makes no sense to show the mnemonic binding in a tooltip. Therefore, the only time we'll show an accelerator key in the tooltip is if someone has added a WHEN_IN_FOCUSED_WINDOW binding to the component's InputMap.
05-07-2017

Checked this with JDK 5u22 and current version and could confirm the issue as reported. The mnemonic shortcut has failed to display when the cursor is moved over the button with all versions post 5u22. The tool tip is displayed as expected though. (see attached images for reference). Result: 5u22: OK 6: FAIL 6u45: FAIL 7u80: FAIL 8u131: FAIL 9 ea b175: FAIL To verify run the attached test case. This seems a regression appeared while migration from JDK 5 to 6.
23-06-2017