-
Bug
-
Resolution: Fixed
-
P4
-
8u20, 9, 10
-
b23
-
x86
-
windows_7
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);
})
);
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);
})
);
- duplicates
-
JDK-6789983 Nimbus tooltips on disabled components have no border, and wrong background colo
-
- Closed
-
-
JDK-6789983 Nimbus tooltips on disabled components have no border, and wrong background colo
-
- Closed
-