JDK-8058785 : Nimbus disabled tooltip needs border
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u20,9,10
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_7
  • CPU: x86
  • Submitted: 2014-09-18
  • Updated: 2017-09-08
  • Resolved: 2017-08-03
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 10
10 b23Fixed
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :


A DESCRIPTION OF THE PROBLEM :
The tooltip for a disabled component in the Nimbus look and feel is a flat gray rectangle with no border. The rectangle is almost identical in color to disabled Nimbus components, so it blends in and looks bad. Adding a simple border looks much better, and is consistent with the appearance of the enabled tooltip.


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import javax.swing.*;

public class NimbusDisabledTooltipTest {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            try {
                UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
            } catch (Exception checkedExceptionsPleaseDie) {
                throw new RuntimeException(checkedExceptionsPleaseDie);
            }
            
            JButton b1 = new JButton("one");
            b1.setToolTipText("An enabled button");
            b1.setMargin(new Insets(20, 20, 20, 20));
            
            JButton b2 = new JButton("two");
            b2.setToolTipText("A disabled button");
            b2.setMargin(b1.getMargin());
            b2.setEnabled(false);
            
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(frame.DISPOSE_ON_CLOSE);
            frame.add(b1, BorderLayout.NORTH);
            frame.add(b2, BorderLayout.SOUTH);
            frame.pack();
            frame.setVisible(true);
        });
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Run after setting the look and feel:

UIManager.put("ToolTip[Disabled].backgroundPainter",
    (Painter<Object>)((g, object, width, height) -> {
        g.setColor(UIManager.getColor("control"));
        g.fillRect(0, 0, width, height);
        g.setColor(UIManager.getColor("nimbusBorder"));
        g.setStroke(new BasicStroke(1));
        g.drawRect(0, 0, width - 1, height - 1);
    })
);


Comments
Testing the fix.
27-07-2017