MenuItem: fixed horizontal alignment of icons (issue #631)

This commit is contained in:
Karl Tauber
2023-01-27 22:43:45 +01:00
parent f8d67f863f
commit 4a0bd2c09f
2 changed files with 3 additions and 1 deletions

View File

@@ -26,6 +26,7 @@ FlatLaf Change Log
#625) #625)
- Updated "Hiberbee Dark" and "Material Theme UI Lite" themes. - Updated "Hiberbee Dark" and "Material Theme UI Lite" themes.
- Styling: Fixed resolving of UI variables in styles that use other variables. - Styling: Fixed resolving of UI variables in styles that use other variables.
- MenuItem: Fixed horizontal alignment of icons. (issue #631)
## 3.0 ## 3.0

View File

@@ -456,10 +456,11 @@ debug*/
return; return;
// center because the real icon may be smaller than dimension in iconRect // 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() ); int y = iconRect.y + centerOffset( iconRect.height, icon.getIconHeight() );
// paint // paint
icon.paintIcon( menuItem, g, iconRect.x, y ); icon.paintIcon( menuItem, g, x, y );
} }
protected static void paintText( Graphics g, JMenuItem menuItem, protected static void paintText( Graphics g, JMenuItem menuItem,