JDK-6552974 : Tooltips do not display accelerator key
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux
  • CPU: x86
  • Submitted: 2007-05-02
  • Updated: 2023-08-30
  • Resolved: 2023-08-30
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Red Hat Enterprise Linux WS 4
kernel: 2.6.9-42.0.8.ELsmp
i686

EXTRA RELEVANT SYSTEM CONFIGURATION :
KDE 3.3.1-6.RHEL4

A DESCRIPTION OF THE PROBLEM :
Mnemonics set on JButtons are not displayed in tooltips. In previous versions the tooltip for a component was appended with the accelerator key. For instance, if the mnemonic of a JButton was 'C', and the tooltip text was "Text", the displayed tooltip would read "Text <Alt-C>".

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The accelerator key to be displayed in the tooltip.
ACTUAL -
The accelerator key was not displayed in the tooltip.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;
public class NoAccel extends JFrame
{
    public JButton aButton;
    public NoAccel()
    {
        aButton = new JButton();
        aButton.setText("Close");
        aButton.setMnemonic('C');
        aButton.setToolTipText("Tool Tip Text");
        getContentPane().add(aButton);
        pack();
        setVisible(true);
    }
    public static void main(String[] args)
    {
        new NoAccel();
    }
}
---------- END SOURCE ----------

Comments
As per JDK-5047379 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 so it is expected behaviour...
30-08-2023

EVALUATION The evaluation for the bug #5047379 says: >Additionally, it was determined that it makes no sense to show the mnemonic binding in >a tooltip. assigned to the responsible engineer of the bug #5047379
29-10-2007