From af756cf16cb8f21ceff4f55d0733136ef1c09d39 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 19 Dec 2016 21:28:04 +0100 Subject: [PATCH] fix selection track bg for vertical sliders --- src/com/bulenkov/darcula/ui/DarculaSliderUI.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/com/bulenkov/darcula/ui/DarculaSliderUI.java b/src/com/bulenkov/darcula/ui/DarculaSliderUI.java index 29cc787..222881c 100644 --- a/src/com/bulenkov/darcula/ui/DarculaSliderUI.java +++ b/src/com/bulenkov/darcula/ui/DarculaSliderUI.java @@ -63,8 +63,8 @@ public class DarculaSliderUI extends BasicSliderUI { if (slider.getOrientation() == JSlider.HORIZONTAL) { int cy = (trackBounds.height / 2) - trackSize / 2; int cw = trackBounds.width; - final Area shape = new Area(new RoundRectangle2D.Double(0, 0, cw, trackSize, arc, arc)); g.translate(trackBounds.x, trackBounds.y + cy); + final Area shape = new Area(new RoundRectangle2D.Double(0, 0, cw, trackSize, arc, arc)); g.setColor(bg); g.fill(shape); int x = thumbRect.x; @@ -76,8 +76,13 @@ public class DarculaSliderUI extends BasicSliderUI { int cx = (trackBounds.width / 2) - trackSize / 2; int ch = trackBounds.height; g.translate(trackBounds.x + cx, trackBounds.y); + final Area shape = new Area(new RoundRectangle2D.Double(0, 0, cx, ch, arc, arc)); g.setColor(bg); - g.fillRoundRect(0, 0, trackSize, ch, arc, arc); + g.fill(shape); + int y = thumbRect.y; + shape.intersect(new Area(new Rectangle2D.Double(0, y, cx, ch))); + g.setColor(selection); + g.fill(shape); g.translate(-(trackBounds.x + cx), -trackBounds.y); } config.restore();