From 069a4e8f0bee921befaa6f36681014d417228b33 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 16 May 2020 14:33:55 +0200 Subject: [PATCH] ToolTip: fixed left/right insets of multi-line tooltips so that they are the same as in single-line tooltips (BasicToolTipUI adds 3 to the left and right) --- .../src/main/java/com/formdev/flatlaf/ui/FlatToolTipUI.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 f46a6348..2b9c1b57 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 @@ -103,7 +103,7 @@ public class FlatToolTipUI for( String line : lines ) width = Math.max( width, SwingUtilities.computeStringWidth( fm, line ) ); - return new Dimension( insets.left + width + insets.right, insets.top + height + insets.bottom ); + return new Dimension( insets.left + width + insets.right + 6, insets.top + height + insets.bottom ); } else return super.getPreferredSize( c ); } @@ -119,8 +119,8 @@ public class FlatToolTipUI List lines = StringUtils.split( ((JToolTip)c).getTipText(), '\n' ); - int x = insets.left; - int x2 = c.getWidth() - insets.right; + int x = insets.left + 3; + int x2 = c.getWidth() - insets.right - 3; int y = insets.top - fm.getDescent(); int lineHeight = fm.getHeight(); JComponent comp = ((JToolTip)c).getComponent();