diff --git a/CHANGELOG.md b/CHANGELOG.md index bfc1a57c..a2ea4202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ FlatLaf Change Log - Fixed white lines at bottom and right side of window (in dark themes on HiDPI screens with scaling enabled). +- ScrollBar: Fixed left/top arrow icon location (if visible). (issue #329) - ToolTip: Fixed positioning of huge tooltips. (issue #333) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java index 8acbdc1e..e0867a98 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatUIUtils.java @@ -679,8 +679,10 @@ public class FlatUIUtils int extra = chevron ? 1 : 0; // compute arrow location - int ax = x + Math.round( ((width - (aw + extra)) / 2f) + UIScale.scale( (float) xOffset ) ); - int ay = y + Math.round( ((height - (ah + extra)) / 2f) + UIScale.scale( (float) yOffset ) ); + float ox = ((width - (aw + extra)) / 2f) + UIScale.scale( (float) xOffset ); + float oy = ((height - (ah + extra)) / 2f) + UIScale.scale( (float) yOffset ); + int ax = x + ((direction == SwingConstants.WEST) ? -Math.round( -ox ) : Math.round( ox )); + int ay = y + ((direction == SwingConstants.NORTH) ? -Math.round( -oy ) : Math.round( oy )); // paint arrow g.translate( ax, ay );