ToolTip: do not show empty tooltip component if tooltip text is an empty string (issue #134)

This commit is contained in:
Karl Tauber
2020-07-28 11:10:34 +02:00
parent e3cda9905a
commit f2ab7fafcf
2 changed files with 7 additions and 0 deletions

View File

@@ -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();