diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d1339d4..8157d29d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ FlatLaf Change Log "JScrollPane.smoothScrolling" is set to a `Boolean` on `JScrollPane`. - ScrollBar: Increased minimum thumb size on macOS and Linux from 8 to 18 pixels. On Windows, it is now 10 pixels. (issue #131) +- ToolTip: Do not show empty tooltip component if tooltip text is an empty + string. (issue #134) ## 0.38 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java index e6a24c35..679a461e 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java @@ -94,6 +94,11 @@ public class FlatToolTipUI @Override public Dimension getPreferredSize( JComponent c ) { + // do not show tool tip if text is empty + String text = ((JToolTip)c).getTipText(); + if( text == null || text.isEmpty() ) + return new Dimension(); + if( isMultiLine( c ) ) { FontMetrics fm = c.getFontMetrics( c.getFont() ); Insets insets = c.getInsets();