Renamed borderLess to borderless

This commit is contained in:
Ingo Kegel
2021-04-08 22:36:42 +02:00
parent ae8323e2f8
commit 32d9381745
4 changed files with 11 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ public interface FlatClientProperties
* {@link #BUTTON_TYPE_TAB}, * {@link #BUTTON_TYPE_TAB},
* {@link #BUTTON_TYPE_HELP} or * {@link #BUTTON_TYPE_HELP} or
* {@link #BUTTON_TYPE_TOOLBAR_BUTTON} * {@link #BUTTON_TYPE_TOOLBAR_BUTTON}
* {@link #BUTTON_TYPE_BORDER_LESS} * {@link #BUTTON_TYPE_BORDERLESS}
*/ */
String BUTTON_TYPE = "JButton.buttonType"; String BUTTON_TYPE = "JButton.buttonType";
@@ -97,7 +97,7 @@ public interface FlatClientProperties
* *
* @see #BUTTON_TYPE * @see #BUTTON_TYPE
*/ */
String BUTTON_TYPE_BORDER_LESS = "borderLess"; String BUTTON_TYPE_BORDERLESS = "borderless";
/** /**
* Specifies selected state of a checkbox. * Specifies selected state of a checkbox.

View File

@@ -75,7 +75,7 @@ public class FlatButtonBorder
public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) { public void paintBorder( Component c, Graphics g, int x, int y, int width, int height ) {
if( FlatButtonUI.isContentAreaFilled( c ) && if( FlatButtonUI.isContentAreaFilled( c ) &&
!FlatButtonUI.isToolBarButton( c ) && !FlatButtonUI.isToolBarButton( c ) &&
( !FlatButtonUI.isBorderLessButton( c ) || FlatUIUtils.isPermanentFocusOwner( c ) ) && ( !FlatButtonUI.isBorderlessButton( c ) || FlatUIUtils.isPermanentFocusOwner( c ) ) &&
!FlatButtonUI.isHelpButton( c ) && !FlatButtonUI.isHelpButton( c ) &&
!FlatToggleButtonUI.isTabButton( c ) ) !FlatToggleButtonUI.isTabButton( c ) )
super.paintBorder( c, g, x, y, width, height ); super.paintBorder( c, g, x, y, width, height );

View File

@@ -285,8 +285,9 @@ public class FlatButtonUI
(c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON )); (c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_TOOLBAR_BUTTON ));
} }
static boolean isBorderLessButton( Component c ) { static boolean isBorderlessButton( Component c ) {
return c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE, BUTTON_TYPE_BORDER_LESS ); return c instanceof AbstractButton && clientPropertyEquals( (AbstractButton) c, BUTTON_TYPE,
BUTTON_TYPE_BORDERLESS );
} }
@Override @Override
@@ -336,7 +337,7 @@ public class FlatButtonUI
// paint shadow // paint shadow
Color shadowColor = def ? defaultShadowColor : this.shadowColor; Color shadowColor = def ? defaultShadowColor : this.shadowColor;
if( !isToolBarButton && !isBorderLessButton( c ) && shadowColor != null && shadowWidth > 0 && focusWidth > 0 && if( !isToolBarButton && !isBorderlessButton( c ) && shadowColor != null && shadowWidth > 0 && focusWidth > 0 &&
!(isFocusPainted( c ) && FlatUIUtils.isPermanentFocusOwner( c )) && c.isEnabled() ) !(isFocusPainted( c ) && FlatUIUtils.isPermanentFocusOwner( c )) && c.isEnabled() )
{ {
g2.setColor( shadowColor ); g2.setColor( shadowColor );
@@ -395,7 +396,7 @@ public class FlatButtonUI
if( ((AbstractButton)c).isSelected() ) { if( ((AbstractButton)c).isSelected() ) {
// in toolbar use same colors for disabled and enabled because // in toolbar use same colors for disabled and enabled because
// we assume that toolbar icon is shown disabled // we assume that toolbar icon is shown disabled
boolean toolBarButton = isToolBarButton( c ) || isBorderLessButton( c ); boolean toolBarButton = isToolBarButton( c ) || isBorderlessButton( c );
return buttonStateColor( c, return buttonStateColor( c,
toolBarButton ? toolbarSelectedBackground : selectedBackground, toolBarButton ? toolbarSelectedBackground : selectedBackground,
toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground, toolBarButton ? toolbarSelectedBackground : disabledSelectedBackground,
@@ -407,7 +408,7 @@ public class FlatButtonUI
return disabledBackground; return disabledBackground;
// toolbar button // toolbar button
if( isToolBarButton( c ) || isBorderLessButton( c ) ) { if( isToolBarButton( c ) || isBorderlessButton( c ) ) {
ButtonModel model = ((AbstractButton)c).getModel(); ButtonModel model = ((AbstractButton)c).getModel();
if( model.isPressed() ) if( model.isPressed() )
return toolbarPressedBackground; return toolbarPressedBackground;
@@ -469,7 +470,7 @@ public class FlatButtonUI
if( !c.isEnabled() ) if( !c.isEnabled() )
return disabledText; return disabledText;
if( ((AbstractButton)c).isSelected() && !( isToolBarButton( c ) || isBorderLessButton( c ) ) ) if( ((AbstractButton)c).isSelected() && !( isToolBarButton( c ) || isBorderlessButton( c ) ) )
return selectedForeground; return selectedForeground;
// use component foreground if explicitly set // use component foreground if explicitly set

View File

@@ -30,7 +30,7 @@ public class FlatButton
implements FlatComponentExtension implements FlatComponentExtension
{ {
// NOTE: enum names must be equal to allowed strings // NOTE: enum names must be equal to allowed strings
public enum ButtonType { none, square, roundRect, tab, help, toolBarButton, borderLess } public enum ButtonType { none, square, roundRect, tab, help, toolBarButton, borderless}
/** /**
* Returns type of a button. * Returns type of a button.