diff --git a/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java b/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java index e8dd2833..2f73996a 100644 --- a/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java +++ b/core/src/main/java/com/github/weisj/darklaf/components/tooltip/ToolTipContext.java @@ -366,8 +366,11 @@ public class ToolTipContext { public void updateToolTip() { if (toolTip != null) { toolTip.putClientProperty(DarkToolTipUI.KEY_POINTER_LOCATION, - alignment == Alignment.CENTER ? centerAlignment.opposite() - : alignInside ? alignment : alignment.opposite()); + alignment == Alignment.CENTER + ? centerAlignment.opposite() + : alignInside + ? alignment + : alignment.opposite()); toolTip.putClientProperty(DarkToolTipUI.KEY_INSETS, insets); toolTip.doLayout(); } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java index 59561978..adda0f70 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java @@ -55,9 +55,10 @@ public class DarkToolTipUI extends BasicToolTipUI boolean inside = isInside(e); if (!inside) { ToolTipManager.sharedInstance() - .mouseExited(new MouseEvent(toolTip.getComponent(), e.getID(), e.getWhen(), e.getModifiersEx(), - Integer.MIN_VALUE, Integer.MIN_VALUE, e.getClickCount(), e.isPopupTrigger(), - e.getButton())); + .mouseExited(new MouseEvent( + toolTip.getComponent(), e.getID(), e.getWhen(), + e.getModifiersEx(), Integer.MIN_VALUE, Integer.MIN_VALUE, + e.getClickCount(), e.isPopupTrigger(), e.getButton())); } } }; @@ -77,8 +78,11 @@ public class DarkToolTipUI extends BasicToolTipUI if (p.y == c.getHeight()) p.y--; p.x = Math.max(p.x, 0); p.y = Math.max(p.y, 0); - ToolTipManager.sharedInstance().mouseEntered(new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiersEx(), - p.x, p.y, e.getClickCount(), e.isPopupTrigger(), e.getButton())); + ToolTipManager.sharedInstance() + .mouseEntered(new MouseEvent( + c, e.getID(), e.getWhen(), + e.getModifiersEx(), p.x, p.y, + e.getClickCount(), e.isPopupTrigger(), e.getButton())); } @Override @@ -209,7 +213,10 @@ public class DarkToolTipUI extends BasicToolTipUI Insets insets = c.getInsets(); Rectangle paintTextR = new Rectangle(insets.left, insets.top, size.width - (insets.left + insets.right), size.height - (insets.top + insets.bottom)); + Rectangle r = new Rectangle(paintTextR); StringPainter.drawString(g, c, tipText, paintTextR); + g.setColor(Color.GREEN); + PaintUtil.drawRect(g, r); } } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipBorder.java index 986166ed..eb43a2ef 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipBorder.java @@ -99,7 +99,7 @@ public class DarkTooltipBorder implements Border, AlignableTooltipBorder { } else if (align == Alignment.WEST) { si.left -= pointerSize; } else if (align.isNorth()) { - si.top = 0; + si.top -= pointerSize; } } @@ -147,14 +147,10 @@ public class DarkTooltipBorder implements Border, AlignableTooltipBorder { Insets ins = new Insets(0, 0, 0, 0); Insets bi = bubbleBorder.getBorderInsets(c); Insets si = shadowBorder.getBorderInsets(c); - ins.bottom = Math.max(bi.bottom, si.bottom); - ins.left = Math.max(bi.left, si.left); - ins.right = Math.max(bi.right, si.right); - ins.top = Math.max(bi.top, si.top); - ins.left += uIns.left; - ins.top += uIns.top; - ins.right += uIns.right; - ins.bottom += uIns.bottom; + ins.bottom = Math.max(bi.bottom, si.bottom) + uIns.bottom; + ins.left = Math.max(bi.left, si.left) + uIns.left; + ins.right = Math.max(bi.right, si.right) + uIns.right; + ins.top = Math.max(bi.top, si.top) + uIns.top; return ins; }