macOS themes: fix horizontal centering of combobox arrows (issue #497; PR #533)

This commit is contained in:
Karl Tauber
2022-12-03 19:17:10 +01:00
parent 9fef2f9d05
commit 4e44e25d30
3 changed files with 71 additions and 20 deletions

View File

@@ -766,12 +766,6 @@ public class FlatComboBoxUI
protected FlatComboBoxButton() {
this( SwingConstants.SOUTH, arrowType, buttonArrowColor, buttonDisabledArrowColor,
buttonHoverArrowColor, null, buttonPressedArrowColor, null );
if( isMacStyle() ) {
setArrowWidth( 7 );
setArrowThickness( 1.5f );
setRoundBorderAutoXOffset( false );
}
}
protected FlatComboBoxButton( int direction, String type, Color foreground, Color disabledForeground,
@@ -786,6 +780,21 @@ public class FlatComboBoxUI
buttonHoverArrowColor, null, buttonPressedArrowColor, null );
}
@Override
public int getArrowWidth() {
return isMacStyle() ? (getWidth() % 2 == 0 ? 6 : 7) : super.getArrowWidth();
}
@Override
public float getArrowThickness() {
return isMacStyle() ? 1.5f : super.getArrowThickness();
}
@Override
public boolean isRoundBorderAutoXOffset() {
return isMacStyle() ? false : super.isRoundBorderAutoXOffset();
}
@Override
protected boolean isHover() {
return super.isHover() || (!comboBox.isEditable() ? hover : false);