diff --git a/CHANGELOG.md b/CHANGELOG.md index 040a2908..43462b45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ FlatLaf Change Log #625) - Updated "Hiberbee Dark" and "Material Theme UI Lite" themes. - Styling: Fixed resolving of UI variables in styles that use other variables. +- MenuItem: Fixed horizontal alignment of icons. (issue #631) ## 3.0 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemRenderer.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemRenderer.java index 65f06687..8a5dd591 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemRenderer.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatMenuItemRenderer.java @@ -456,10 +456,11 @@ debug*/ return; // center because the real icon may be smaller than dimension in iconRect + int x = iconRect.x + centerOffset( iconRect.width, icon.getIconWidth() ); int y = iconRect.y + centerOffset( iconRect.height, icon.getIconHeight() ); // paint - icon.paintIcon( menuItem, g, iconRect.x, y ); + icon.paintIcon( menuItem, g, x, y ); } protected static void paintText( Graphics g, JMenuItem menuItem,