From ef4deb1e8bed9af1966debf2e2a9ca4f5b69f7a3 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Wed, 27 Apr 2022 22:48:11 +0200 Subject: [PATCH] Avoid shadowing class variables --- .../darklaf/ui/button/DarkButtonBorder.java | 18 +++++++++--------- .../weisj/darklaf/ui/button/DarkButtonUI.java | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java index 54eee6cd..869ae3da 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonBorder.java @@ -108,21 +108,21 @@ public class DarkButtonBorder implements Border, UIResource, VisualPaddingProvid Graphics2D g2 = (Graphics2D) g; g2.translate(x, y); - int arc = getArc(c); - int focusArc = getFocusArc(c); + int arcSize = getArc(c); + int focusArcSize = getFocusArc(c); GraphicsContext config = new GraphicsContext(g); AlignmentExt corner = getCornerFlag(c); boolean paintShadow = showDropShadow(corner); boolean focus = paintFocus(c); int shadowHeight = paintShadow ? getShadowSize() : 0; - int borderSize = getBorderSize(); + int bs = getBorderSize(); - Insets insetMask = new Insets(borderSize, borderSize, Math.max(borderSize, shadowHeight), borderSize); + Insets insetMask = new Insets(bs, bs, Math.max(bs, shadowHeight), bs); Insets focusIns = new Insets(0, 0, 0, 0); if (corner != null) { - focusIns = corner.maskInsets(focusIns, -borderSize - focusArc); - insetMask = corner.maskInsets(insetMask, -arc); + focusIns = corner.maskInsets(focusIns, -bs - focusArcSize); + insetMask = corner.maskInsets(insetMask, -arcSize); } int bx = insetMask.left; @@ -132,13 +132,13 @@ public class DarkButtonBorder implements Border, UIResource, VisualPaddingProvid int fx = focusIns.left; int fy = focusIns.top; int fw = width - focusIns.left - focusIns.right; - int fh = by + bh + borderSize - focusIns.top - focusIns.bottom; + int fh = by + bh + bs - focusIns.top - focusIns.bottom; if (paintFocus(c)) { - paintFocusBorder(g2, focusArc, borderSize, fx, fy, fw, fh); + paintFocusBorder(g2, focusArcSize, bs, fx, fy, fw, fh); } - paintLineBorder(c, g2, arc, focus, bx, by, bw, bh); + paintLineBorder(c, g2, arcSize, focus, bx, by, bw, bh); if (corner != null) { paintNeighbourFocus(g2, c, width, height); diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java index cb01141c..b866632f 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/button/DarkButtonUI.java @@ -209,7 +209,7 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { Graphics2D g2 = (Graphics2D) g; AbstractButton b = (AbstractButton) c; if (shouldDrawBackground(b)) { - int arc = getArc(c); + int arcSize = getArc(c); int width = c.getWidth(); int height = c.getHeight(); Insets margin = b.getMargin(); @@ -217,9 +217,9 @@ public class DarkButtonUI extends BasicButtonUI implements ButtonConstants { margin = null; } if (ButtonConstants.isBorderlessVariant(c)) { - paintBorderlessBackground(b, g2, arc, width, height, margin); + paintBorderlessBackground(b, g2, arcSize, width, height, margin); } else if (b.getBorder() instanceof DarkButtonBorder) { - paintDarklafBorderBackground(b, g2, arc, width, height); + paintDarklafBorderBackground(b, g2, arcSize, width, height); } else { paintDefaultBackground(b, g2, width, height); }