Menus: use simpler method to compute center offset (same as in SwingUtilities.layoutCompoundLabel()), which gives same results and avoids floats

This commit is contained in:
Karl Tauber
2020-04-27 13:14:11 +02:00
parent 06eeced5b2
commit dd2cf50a39

View File

@@ -184,7 +184,7 @@ public class FlatMenuItemRenderer
} }
private static int centerOffset( int wh1, int wh2 ) { private static int centerOffset( int wh1, int wh2 ) {
return (wh1 != wh2) ? Math.round( (wh1 - wh2) / 2f ) : 0; return (wh1 / 2) - (wh2 / 2);
} }
protected void paintMenuItem( Graphics g, Color selectionBackground, Color selectionForeground, protected void paintMenuItem( Graphics g, Color selectionBackground, Color selectionForeground,