ComboBox, Spinner, TextField and subclasses, CheckBox, RadioButton and Slider: support specifying width of borders

This commit is contained in:
Karl Tauber
2021-10-30 14:02:49 +02:00
parent 8c2be1b406
commit dd80614465
17 changed files with 137 additions and 62 deletions

View File

@@ -32,6 +32,12 @@ FlatLaf Change Log
- arrow keys move focus within toolbar - arrow keys move focus within toolbar
- tab-key moves focus out of toolbar - tab-key moves focus out of toolbar
- if moving focus into the toolbar, focus recently focused toolbar button - if moving focus into the toolbar, focus recently focused toolbar button
- ComboBox, Spinner, TextField and subclasses: Support specifying width of
border (see UI value `Component.borderWidth`).
- CheckBox and RadioButton: Support specifying width of icon border (see UI
value `CheckBox.icon.borderWidth`).
- Slider: Support specifying width of thumb border (see UI value
`Slider.thumbBorderWidth`).
- Added more color functions to class `ColorFunctions` for easy use in - Added more color functions to class `ColorFunctions` for easy use in
applications: `lighten()`, `darken()`, `saturate()`, `desaturate()`, `spin()`, applications: `lighten()`, `darken()`, `saturate()`, `desaturate()`, `spin()`,
`tint()`, `shade()` and `luma()`. `tint()`, `shade()` and `luma()`.

View File

@@ -34,15 +34,19 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
/** /**
* Icon for {@link javax.swing.JCheckBox}. * Icon for {@link javax.swing.JCheckBox}.
* * <p>
* Note: If Component.focusWidth is greater than zero, then the outline focus border * <strong>Note</strong>:
* If Component.focusWidth is greater than zero, then the outer focus border
* is painted outside of the icon bounds. Make sure that the checkbox * is painted outside of the icon bounds. Make sure that the checkbox
* has margins, which are equal or greater than focusWidth. * has margins, which are equal or greater than focusWidth.
* *
* @uiDefault CheckBox.icon.style String optional; "outline"/null (default) or "filled" * @uiDefault CheckBox.icon.style String optional; "outlined"/null (default) or "filled"
* @uiDefault Component.focusWidth int * @uiDefault Component.focusWidth int
* @uiDefault Component.borderWidth int
* @uiDefault Component.focusColor Color * @uiDefault Component.focusColor Color
* @uiDefault CheckBox.icon.focusWidth int optional; defaults to Component.focusWidth * @uiDefault CheckBox.icon.focusWidth int optional; defaults to Component.focusWidth
* @uiDefault CheckBox.icon.borderWidth int or float optional; defaults to Component.borderWidth
*
* @uiDefault CheckBox.icon.focusColor Color optional; defaults to Component.focusColor * @uiDefault CheckBox.icon.focusColor Color optional; defaults to Component.focusColor
* @uiDefault CheckBox.icon.borderColor Color * @uiDefault CheckBox.icon.borderColor Color
* @uiDefault CheckBox.icon.background Color * @uiDefault CheckBox.icon.background Color
@@ -74,6 +78,8 @@ public class FlatCheckBoxIcon
UIManager.getInt( "Component.focusWidth" ), style ); UIManager.getInt( "Component.focusWidth" ), style );
@Styleable protected Color focusColor = FlatUIUtils.getUIColor( "CheckBox.icon.focusColor", @Styleable protected Color focusColor = FlatUIUtils.getUIColor( "CheckBox.icon.focusColor",
UIManager.getColor( "Component.focusColor" ) ); UIManager.getColor( "Component.focusColor" ) );
/** @since 2 */ @Styleable protected float borderWidth = getUIFloat( "CheckBox.icon.borderWidth",
FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ), style );
@Styleable protected int arc = FlatUIUtils.getUIInt( "CheckBox.arc", 2 ); @Styleable protected int arc = FlatUIUtils.getUIInt( "CheckBox.arc", 2 );
// enabled // enabled
@@ -115,13 +121,23 @@ public class FlatCheckBoxIcon
protected static int getUIInt( String key, int defaultValue, String style ) { protected static int getUIInt( String key, int defaultValue, String style ) {
if( style != null ) { if( style != null ) {
Object value = UIManager.get( styleKey( key, style ) ); int value = FlatUIUtils.getUIInt( styleKey( key, style ), Integer.MIN_VALUE );
if( value instanceof Integer ) if( value != Integer.MIN_VALUE )
return (Integer) value; return value;
} }
return FlatUIUtils.getUIInt( key, defaultValue ); return FlatUIUtils.getUIInt( key, defaultValue );
} }
/** @since 2 */
protected static float getUIFloat( String key, float defaultValue, String style ) {
if( style != null ) {
float value = FlatUIUtils.getUIFloat( styleKey( key, style ), Float.MIN_VALUE );
if( value != Float.MIN_VALUE )
return value;
}
return FlatUIUtils.getUIFloat( key, defaultValue );
}
private static String styleKey( String key, String style ) { private static String styleKey( String key, String style ) {
return key.replace( ".icon.", ".icon[" + style + "]." ); return key.replace( ".icon.", ".icon[" + style + "]." );
} }
@@ -180,7 +196,7 @@ public class FlatCheckBoxIcon
} }
protected void paintFocusBorder( Component c, Graphics2D g ) { protected void paintFocusBorder( Component c, Graphics2D g ) {
// the outline focus border is painted outside of the icon // the outer focus border is painted outside of the icon
int wh = ICON_SIZE - 1 + (focusWidth * 2); int wh = ICON_SIZE - 1 + (focusWidth * 2);
int arcwh = arc + (focusWidth * 2); int arcwh = arc + (focusWidth * 2);
g.fillRoundRect( -focusWidth + 1, -focusWidth, wh, wh, arcwh, arcwh ); g.fillRoundRect( -focusWidth + 1, -focusWidth, wh, wh, arcwh, arcwh );
@@ -192,8 +208,10 @@ public class FlatCheckBoxIcon
} }
protected void paintBackground( Component c, Graphics2D g ) { protected void paintBackground( Component c, Graphics2D g ) {
float xy = borderWidth;
float wh = 14 - (borderWidth * 2);
int arcwh = arc - 1; int arcwh = arc - 1;
g.fillRoundRect( 2, 1, 12, 12, arcwh, arcwh ); g.fill( new RoundRectangle2D.Float( 1 + xy, xy, wh, wh, arcwh, arcwh ) );
} }
protected void paintCheckmark( Component c, Graphics2D g ) { protected void paintCheckmark( Component c, Graphics2D g ) {

View File

@@ -23,23 +23,24 @@ import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
/** /**
* Icon for {@link javax.swing.JRadioButton}. * Icon for {@link javax.swing.JRadioButton}.
* * <p>
* Note: If Component.focusWidth is greater than zero, then the outline focus border * <strong>Note</strong>:
* If Component.focusWidth is greater than zero, then the outer focus border
* is painted outside of the icon bounds. Make sure that the radiobutton * is painted outside of the icon bounds. Make sure that the radiobutton
* has margins, which are equal or greater than focusWidth. * has margins, which are equal or greater than focusWidth.
* *
* @uiDefault RadioButton.icon.centerDiameter int * @uiDefault RadioButton.icon.centerDiameter int or float
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatRadioButtonIcon public class FlatRadioButtonIcon
extends FlatCheckBoxIcon extends FlatCheckBoxIcon
{ {
@Styleable protected int centerDiameter = getUIInt( "RadioButton.icon.centerDiameter", 8, style ); @Styleable protected float centerDiameter = getUIFloat( "RadioButton.icon.centerDiameter", 8, style );
@Override @Override
protected void paintFocusBorder( Component c, Graphics2D g ) { protected void paintFocusBorder( Component c, Graphics2D g ) {
// the outline focus border is painted outside of the icon // the outer focus border is painted outside of the icon
int wh = ICON_SIZE + (focusWidth * 2); int wh = ICON_SIZE + (focusWidth * 2);
g.fillOval( -focusWidth, -focusWidth, wh, wh ); g.fillOval( -focusWidth, -focusWidth, wh, wh );
} }
@@ -51,7 +52,9 @@ public class FlatRadioButtonIcon
@Override @Override
protected void paintBackground( Component c, Graphics2D g ) { protected void paintBackground( Component c, Graphics2D g ) {
g.fillOval( 1, 1, 13, 13 ); float xy = borderWidth;
float wh = 15 - (borderWidth * 2);
g.fill( new Ellipse2D.Float( xy, xy, wh, wh ) );
} }
@Override @Override

View File

@@ -38,17 +38,19 @@ import com.formdev.flatlaf.util.DerivedColor;
/** /**
* Border for various components (e.g. {@link javax.swing.JTextField}). * Border for various components (e.g. {@link javax.swing.JTextField}).
* * <p>
* There is empty space around the component border, if Component.focusWidth is greater than zero, * There is empty space around the component border, if Component.focusWidth is greater than zero,
* which is used to paint outer focus border. * which is used to paint outer focus border.
* * <p>
* Because there is empty space (if outer focus border is not painted), * Because there is empty space (if outer focus border is not painted),
* UI delegates that use this border (or subclasses) must invoke * UI delegates that use this border (or subclasses) must invoke
* {@link FlatUIUtils#paintParentBackground} to paint the empty space correctly. * {@link FlatUIUtils#paintParentBackground} to fill the empty space correctly.
* *
* @uiDefault Component.focusWidth int * @uiDefault Component.focusWidth int
* @uiDefault Component.innerFocusWidth int or float * @uiDefault Component.innerFocusWidth int or float
* @uiDefault Component.innerOutlineWidth int or float * @uiDefault Component.innerOutlineWidth int or float
* @uiDefault Component.borderWidth int or float
*
* @uiDefault Component.focusColor Color * @uiDefault Component.focusColor Color
* @uiDefault Component.borderColor Color * @uiDefault Component.borderColor Color
* @uiDefault Component.disabledBorderColor Color * @uiDefault Component.disabledBorderColor Color
@@ -69,6 +71,8 @@ public class FlatBorder
@Styleable protected int focusWidth = UIManager.getInt( "Component.focusWidth" ); @Styleable protected int focusWidth = UIManager.getInt( "Component.focusWidth" );
@Styleable protected float innerFocusWidth = FlatUIUtils.getUIFloat( "Component.innerFocusWidth", 0 ); @Styleable protected float innerFocusWidth = FlatUIUtils.getUIFloat( "Component.innerFocusWidth", 0 );
@Styleable protected float innerOutlineWidth = FlatUIUtils.getUIFloat( "Component.innerOutlineWidth", 0 ); @Styleable protected float innerOutlineWidth = FlatUIUtils.getUIFloat( "Component.innerOutlineWidth", 0 );
/** @since 2 */ @Styleable protected float borderWidth = FlatUIUtils.getUIFloat( "Component.borderWidth", 1 );
@Styleable protected Color focusColor = UIManager.getColor( "Component.focusColor" ); @Styleable protected Color focusColor = UIManager.getColor( "Component.focusColor" );
@Styleable protected Color borderColor = UIManager.getColor( "Component.borderColor" ); @Styleable protected Color borderColor = UIManager.getColor( "Component.borderColor" );
@Styleable protected Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" ); @Styleable protected Color disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
@@ -105,7 +109,7 @@ public class FlatBorder
float focusWidth = scale( (float) getFocusWidth( c ) ); float focusWidth = scale( (float) getFocusWidth( c ) );
float focusInnerWidth = 0; float focusInnerWidth = 0;
float borderWidth = scale( (float) getBorderWidth( c ) ); float borderWidth = scale( getBorderWidth( c ) );
float arc = scale( (float) getArc( c ) ); float arc = scale( (float) getArc( c ) );
Color outlineColor = getOutlineColor( c ); Color outlineColor = getOutlineColor( c );
Color focusColor = null; Color focusColor = null;
@@ -264,8 +268,8 @@ public class FlatBorder
* Returns the (unscaled) line thickness used to paint the border. * Returns the (unscaled) line thickness used to paint the border.
* This may be different to {@link #getLineWidth}. * This may be different to {@link #getLineWidth}.
*/ */
protected int getBorderWidth( Component c ) { protected float getBorderWidth( Component c ) {
return getLineWidth( c ); return borderWidth;
} }
/** /**

View File

@@ -32,53 +32,55 @@ import com.formdev.flatlaf.util.UIScale;
/** /**
* Border for {@link javax.swing.JButton}. * Border for {@link javax.swing.JButton}.
* *
* @uiDefault Button.arc int
* @uiDefault Button.innerFocusWidth int or float optional; defaults to Component.innerFocusWidth
* @uiDefault Button.borderWidth int or float optional; defaults to Component.borderWidth
*
* @uiDefault Button.borderColor Color * @uiDefault Button.borderColor Color
* @uiDefault Button.startBorderColor Color optional; if set, a gradient paint is used and Button.borderColor is ignored * @uiDefault Button.startBorderColor Color optional; if set, a gradient paint is used and Button.borderColor is ignored
* @uiDefault Button.endBorderColor Color optional; if set, a gradient paint is used * @uiDefault Button.endBorderColor Color optional; if set, a gradient paint is used
* @uiDefault Button.disabledBorderColor Color * @uiDefault Button.disabledBorderColor Color
* @uiDefault Button.focusedBorderColor Color * @uiDefault Button.focusedBorderColor Color
* @uiDefault Button.hoverBorderColor Color optional * @uiDefault Button.hoverBorderColor Color optional
*
* @uiDefault Button.default.borderWidth int or float
* @uiDefault Button.default.borderColor Color * @uiDefault Button.default.borderColor Color
* @uiDefault Button.default.startBorderColor Color optional; if set, a gradient paint is used and Button.default.borderColor is ignored * @uiDefault Button.default.startBorderColor Color optional; if set, a gradient paint is used and Button.default.borderColor is ignored
* @uiDefault Button.default.endBorderColor Color optional; if set, a gradient paint is used * @uiDefault Button.default.endBorderColor Color optional; if set, a gradient paint is used
* @uiDefault Button.default.focusedBorderColor Color * @uiDefault Button.default.focusedBorderColor Color
* @uiDefault Button.default.focusColor Color * @uiDefault Button.default.focusColor Color
* @uiDefault Button.default.hoverBorderColor Color optional * @uiDefault Button.default.hoverBorderColor Color optional
*
* @uiDefault Button.toolbar.focusWidth int or float optional; default is 1.5
* @uiDefault Button.toolbar.focusColor Color optional; defaults to Component.focusColor * @uiDefault Button.toolbar.focusColor Color optional; defaults to Component.focusColor
* @uiDefault Button.borderWidth int
* @uiDefault Button.default.borderWidth int
* @uiDefault Button.innerFocusWidth int or float optional; defaults to Component.innerFocusWidth
* @uiDefault Button.toolbar.margin Insets * @uiDefault Button.toolbar.margin Insets
* @uiDefault Button.toolbar.spacingInsets Insets * @uiDefault Button.toolbar.spacingInsets Insets
* @uiDefault Button.toolbar.focusWidth int or float optional; default is 1.5
* @uiDefault Button.arc int
* *
* @author Karl Tauber * @author Karl Tauber
*/ */
public class FlatButtonBorder public class FlatButtonBorder
extends FlatBorder extends FlatBorder
{ {
@Styleable protected int arc = UIManager.getInt( "Button.arc" );
protected Color endBorderColor = UIManager.getColor( "Button.endBorderColor" ); protected Color endBorderColor = UIManager.getColor( "Button.endBorderColor" );
@Styleable protected Color hoverBorderColor = UIManager.getColor( "Button.hoverBorderColor" ); @Styleable protected Color hoverBorderColor = UIManager.getColor( "Button.hoverBorderColor" );
@Styleable(dot=true) protected float defaultBorderWidth = FlatUIUtils.getUIFloat( "Button.default.borderWidth", 1 );
@Styleable(dot=true) protected Color defaultBorderColor = FlatUIUtils.getUIColor( "Button.default.startBorderColor", "Button.default.borderColor" ); @Styleable(dot=true) protected Color defaultBorderColor = FlatUIUtils.getUIColor( "Button.default.startBorderColor", "Button.default.borderColor" );
protected Color defaultEndBorderColor = UIManager.getColor( "Button.default.endBorderColor" ); protected Color defaultEndBorderColor = UIManager.getColor( "Button.default.endBorderColor" );
@Styleable(dot=true) protected Color defaultFocusedBorderColor = UIManager.getColor( "Button.default.focusedBorderColor" ); @Styleable(dot=true) protected Color defaultFocusedBorderColor = UIManager.getColor( "Button.default.focusedBorderColor" );
@Styleable(dot=true) protected Color defaultFocusColor = UIManager.getColor( "Button.default.focusColor" ); @Styleable(dot=true) protected Color defaultFocusColor = UIManager.getColor( "Button.default.focusColor" );
@Styleable(dot=true) protected Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" ); @Styleable(dot=true) protected Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" );
/** @since 1.4 */
@Styleable(dot=true) protected Color toolbarFocusColor = UIManager.getColor( "Button.toolbar.focusColor" );
@Styleable protected int borderWidth = UIManager.getInt( "Button.borderWidth" ); /** @since 1.4 */ @Styleable(dot=true) protected float toolbarFocusWidth = FlatUIUtils.getUIFloat( "Button.toolbar.focusWidth", 1.5f );
@Styleable(dot=true) protected int defaultBorderWidth = UIManager.getInt( "Button.default.borderWidth" ); /** @since 1.4 */ @Styleable(dot=true) protected Color toolbarFocusColor = UIManager.getColor( "Button.toolbar.focusColor" );
@Styleable(dot=true) protected Insets toolbarMargin = UIManager.getInsets( "Button.toolbar.margin" ); @Styleable(dot=true) protected Insets toolbarMargin = UIManager.getInsets( "Button.toolbar.margin" );
@Styleable(dot=true) protected Insets toolbarSpacingInsets = UIManager.getInsets( "Button.toolbar.spacingInsets" ); @Styleable(dot=true) protected Insets toolbarSpacingInsets = UIManager.getInsets( "Button.toolbar.spacingInsets" );
/** @since 1.4 */
@Styleable(dot=true) protected float toolbarFocusWidth = FlatUIUtils.getUIFloat( "Button.toolbar.focusWidth", 1.5f );
@Styleable protected int arc = UIManager.getInt( "Button.arc" );
public FlatButtonBorder() { public FlatButtonBorder() {
innerFocusWidth = FlatUIUtils.getUIFloat( "Button.innerFocusWidth", innerFocusWidth ); innerFocusWidth = FlatUIUtils.getUIFloat( "Button.innerFocusWidth", innerFocusWidth );
borderWidth = FlatUIUtils.getUIFloat( "Button.borderWidth", borderWidth );
borderColor = FlatUIUtils.getUIColor( "Button.startBorderColor", "Button.borderColor" ); borderColor = FlatUIUtils.getUIColor( "Button.startBorderColor", "Button.borderColor" );
disabledBorderColor = UIManager.getColor( "Button.disabledBorderColor" ); disabledBorderColor = UIManager.getColor( "Button.disabledBorderColor" );
@@ -181,7 +183,7 @@ public class FlatButtonBorder
} }
@Override @Override
protected int getBorderWidth( Component c ) { protected float getBorderWidth( Component c ) {
return FlatButtonUI.isDefaultButton( c ) ? defaultBorderWidth : borderWidth; return FlatButtonUI.isDefaultButton( c ) ? defaultBorderWidth : borderWidth;
} }

View File

@@ -101,6 +101,7 @@ import com.formdev.flatlaf.util.SystemInfo;
* @uiDefault ComboBox.buttonBackground Color * @uiDefault ComboBox.buttonBackground Color
* @uiDefault ComboBox.buttonEditableBackground Color * @uiDefault ComboBox.buttonEditableBackground Color
* @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground * @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground
* @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
* @uiDefault ComboBox.buttonSeparatorColor Color optional * @uiDefault ComboBox.buttonSeparatorColor Color optional
* @uiDefault ComboBox.buttonDisabledSeparatorColor Color optional * @uiDefault ComboBox.buttonDisabledSeparatorColor Color optional
* @uiDefault ComboBox.buttonArrowColor Color * @uiDefault ComboBox.buttonArrowColor Color
@@ -129,6 +130,7 @@ public class FlatComboBoxUI
@Styleable protected Color buttonBackground; @Styleable protected Color buttonBackground;
@Styleable protected Color buttonEditableBackground; @Styleable protected Color buttonEditableBackground;
@Styleable protected Color buttonFocusedBackground; @Styleable protected Color buttonFocusedBackground;
/** @since 2 */ @Styleable protected float buttonSeparatorWidth;
/** @since 2 */ @Styleable protected Color buttonSeparatorColor; /** @since 2 */ @Styleable protected Color buttonSeparatorColor;
/** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor; /** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor;
@Styleable protected Color buttonArrowColor; @Styleable protected Color buttonArrowColor;
@@ -223,6 +225,7 @@ public class FlatComboBoxUI
buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" ); buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" );
buttonFocusedBackground = UIManager.getColor( "ComboBox.buttonFocusedBackground" ); buttonFocusedBackground = UIManager.getColor( "ComboBox.buttonFocusedBackground" );
buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" ); buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
buttonSeparatorWidth = FlatUIUtils.getUIFloat( "ComboBox.buttonSeparatorWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ) );
buttonSeparatorColor = UIManager.getColor( "ComboBox.buttonSeparatorColor" ); buttonSeparatorColor = UIManager.getColor( "ComboBox.buttonSeparatorColor" );
buttonDisabledSeparatorColor = UIManager.getColor( "ComboBox.buttonDisabledSeparatorColor" ); buttonDisabledSeparatorColor = UIManager.getColor( "ComboBox.buttonDisabledSeparatorColor" );
buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" ); buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" );
@@ -556,7 +559,7 @@ public class FlatComboBoxUI
Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor; Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor;
if( separatorColor != null ) { if( separatorColor != null ) {
g2.setColor( separatorColor ); g2.setColor( separatorColor );
float lw = scale( 1f ); float lw = scale( buttonSeparatorWidth );
float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw; float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw;
g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2)) ); g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2)) );
} }

View File

@@ -65,6 +65,8 @@ import com.formdev.flatlaf.util.UIScale;
* @uiDefault Slider.trackWidth int * @uiDefault Slider.trackWidth int
* @uiDefault Slider.thumbSize Dimension * @uiDefault Slider.thumbSize Dimension
* @uiDefault Slider.focusWidth int * @uiDefault Slider.focusWidth int
* @uiDefault Slider.thumbBorderWidth int or float
*
* @uiDefault Slider.trackValueColor Color optional; defaults to Slider.thumbColor * @uiDefault Slider.trackValueColor Color optional; defaults to Slider.thumbColor
* @uiDefault Slider.trackColor Color * @uiDefault Slider.trackColor Color
* @uiDefault Slider.thumbColor Color * @uiDefault Slider.thumbColor Color
@@ -86,6 +88,7 @@ public class FlatSliderUI
@Styleable protected int trackWidth; @Styleable protected int trackWidth;
@Styleable protected Dimension thumbSize; @Styleable protected Dimension thumbSize;
@Styleable protected int focusWidth; @Styleable protected int focusWidth;
/** @since 2 */ @Styleable protected float thumbBorderWidth;
@Styleable protected Color trackValueColor; @Styleable protected Color trackValueColor;
@Styleable protected Color trackColor; @Styleable protected Color trackColor;
@@ -139,6 +142,7 @@ public class FlatSliderUI
thumbSize = new Dimension( thumbWidth, thumbWidth ); thumbSize = new Dimension( thumbWidth, thumbWidth );
} }
focusWidth = FlatUIUtils.getUIInt( "Slider.focusWidth", 4 ); focusWidth = FlatUIUtils.getUIInt( "Slider.focusWidth", 4 );
thumbBorderWidth = FlatUIUtils.getUIFloat( "Slider.thumbBorderWidth", 1 );
trackValueColor = FlatUIUtils.getUIColor( "Slider.trackValueColor", "Slider.thumbColor" ); trackValueColor = FlatUIUtils.getUIColor( "Slider.trackValueColor", "Slider.thumbColor" );
trackColor = UIManager.getColor( "Slider.trackColor" ); trackColor = UIManager.getColor( "Slider.trackColor" );
@@ -405,11 +409,11 @@ debug*/
Color focusedColor = FlatUIUtils.deriveColor( this.focusedColor, Color focusedColor = FlatUIUtils.deriveColor( this.focusedColor,
(foreground != defaultForeground) ? foreground : focusBaseColor ); (foreground != defaultForeground) ? foreground : focusBaseColor );
paintThumb( g, slider, thumbRect, isRoundThumb(), color, borderColor, focusedColor, focusWidth ); paintThumb( g, slider, thumbRect, isRoundThumb(), color, borderColor, focusedColor, thumbBorderWidth, focusWidth );
} }
public static void paintThumb( Graphics g, JSlider slider, Rectangle thumbRect, boolean roundThumb, public static void paintThumb( Graphics g, JSlider slider, Rectangle thumbRect, boolean roundThumb,
Color thumbColor, Color thumbBorderColor, Color focusedColor, int focusWidth ) Color thumbColor, Color thumbBorderColor, Color focusedColor, float thumbBorderWidth, int focusWidth )
{ {
double systemScaleFactor = UIScale.getSystemScaleFactor( (Graphics2D) g ); double systemScaleFactor = UIScale.getSystemScaleFactor( (Graphics2D) g );
if( systemScaleFactor != 1 && systemScaleFactor != 2 ) { if( systemScaleFactor != 1 && systemScaleFactor != 2 ) {
@@ -418,18 +422,20 @@ debug*/
(g2d, x2, y2, width2, height2, scaleFactor) -> { (g2d, x2, y2, width2, height2, scaleFactor) -> {
paintThumbImpl( g, slider, x2, y2, width2, height2, paintThumbImpl( g, slider, x2, y2, width2, height2,
roundThumb, thumbColor, thumbBorderColor, focusedColor, roundThumb, thumbColor, thumbBorderColor, focusedColor,
(float) (thumbBorderWidth * scaleFactor),
(float) (focusWidth * scaleFactor) ); (float) (focusWidth * scaleFactor) );
} ); } );
return; return;
} }
paintThumbImpl( g, slider, thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height, paintThumbImpl( g, slider, thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height,
roundThumb, thumbColor, thumbBorderColor, focusedColor, focusWidth ); roundThumb, thumbColor, thumbBorderColor, focusedColor, thumbBorderWidth, focusWidth );
} }
private static void paintThumbImpl( Graphics g, JSlider slider, int x, int y, int width, int height, private static void paintThumbImpl( Graphics g, JSlider slider, int x, int y, int width, int height,
boolean roundThumb, Color thumbColor, Color thumbBorderColor, Color focusedColor, float focusWidth ) boolean roundThumb, Color thumbColor, Color thumbBorderColor, Color focusedColor,
float thumbBorderWidth, float focusWidth )
{ {
int fw = Math.round( UIScale.scale( focusWidth ) ); int fw = Math.round( UIScale.scale( focusWidth ) );
int tx = x + fw; int tx = x + fw;
@@ -451,7 +457,7 @@ debug*/
((Graphics2D)g).fill( createRoundThumbShape( tx, ty, tw, th ) ); ((Graphics2D)g).fill( createRoundThumbShape( tx, ty, tw, th ) );
// paint thumb background // paint thumb background
float lw = UIScale.scale( 1f ); float lw = UIScale.scale( thumbBorderWidth );
g.setColor( thumbColor ); g.setColor( thumbColor );
((Graphics2D)g).fill( createRoundThumbShape( tx + lw, ty + lw, ((Graphics2D)g).fill( createRoundThumbShape( tx + lw, ty + lw,
tw - lw - lw, th - lw - lw ) ); tw - lw - lw, th - lw - lw ) );
@@ -492,7 +498,7 @@ debug*/
g2.fill( createDirectionalThumbShape( fw, fw, tw, th, 0 ) ); g2.fill( createDirectionalThumbShape( fw, fw, tw, th, 0 ) );
// paint thumb background // paint thumb background
float lw = UIScale.scale( 1f ); float lw = UIScale.scale( thumbBorderWidth );
g2.setColor( thumbColor ); g2.setColor( thumbColor );
g2.fill( createDirectionalThumbShape( fw + lw, fw + lw, g2.fill( createDirectionalThumbShape( fw + lw, fw + lw,
tw - lw - lw, th - lw - lw - (lw * 0.4142f), 0 ) ); tw - lw - lw, th - lw - lw - (lw * 0.4142f), 0 ) );

View File

@@ -72,6 +72,7 @@ import com.formdev.flatlaf.util.LoggingFacade;
* @uiDefault Spinner.disabledForeground Color * @uiDefault Spinner.disabledForeground Color
* @uiDefault Spinner.focusedBackground Color optional * @uiDefault Spinner.focusedBackground Color optional
* @uiDefault Spinner.buttonBackground Color * @uiDefault Spinner.buttonBackground Color
* @uiDefault Spinner.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
* @uiDefault Spinner.buttonSeparatorColor Color optional * @uiDefault Spinner.buttonSeparatorColor Color optional
* @uiDefault Spinner.buttonDisabledSeparatorColor Color optional * @uiDefault Spinner.buttonDisabledSeparatorColor Color optional
* @uiDefault Spinner.buttonArrowColor Color * @uiDefault Spinner.buttonArrowColor Color
@@ -96,6 +97,7 @@ public class FlatSpinnerUI
@Styleable protected Color disabledForeground; @Styleable protected Color disabledForeground;
@Styleable protected Color focusedBackground; @Styleable protected Color focusedBackground;
@Styleable protected Color buttonBackground; @Styleable protected Color buttonBackground;
/** @since 2 */ @Styleable protected float buttonSeparatorWidth;
/** @since 2 */ @Styleable protected Color buttonSeparatorColor; /** @since 2 */ @Styleable protected Color buttonSeparatorColor;
/** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor; /** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor;
@Styleable protected Color buttonArrowColor; @Styleable protected Color buttonArrowColor;
@@ -132,6 +134,7 @@ public class FlatSpinnerUI
disabledForeground = UIManager.getColor( "Spinner.disabledForeground" ); disabledForeground = UIManager.getColor( "Spinner.disabledForeground" );
focusedBackground = UIManager.getColor( "Spinner.focusedBackground" ); focusedBackground = UIManager.getColor( "Spinner.focusedBackground" );
buttonBackground = UIManager.getColor( "Spinner.buttonBackground" ); buttonBackground = UIManager.getColor( "Spinner.buttonBackground" );
buttonSeparatorWidth = FlatUIUtils.getUIFloat( "Spinner.buttonSeparatorWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ) );
buttonSeparatorColor = UIManager.getColor( "Spinner.buttonSeparatorColor" ); buttonSeparatorColor = UIManager.getColor( "Spinner.buttonSeparatorColor" );
buttonDisabledSeparatorColor = UIManager.getColor( "Spinner.buttonDisabledSeparatorColor" ); buttonDisabledSeparatorColor = UIManager.getColor( "Spinner.buttonDisabledSeparatorColor" );
buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" ); buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" );
@@ -397,7 +400,7 @@ public class FlatSpinnerUI
Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor; Color separatorColor = enabled ? buttonSeparatorColor : buttonDisabledSeparatorColor;
if( separatorColor != null ) { if( separatorColor != null ) {
g2.setColor( separatorColor ); g2.setColor( separatorColor );
float lw = scale( 1f ); float lw = scale( buttonSeparatorWidth );
float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw; float lx = isLeftToRight ? arrowX : arrowX + arrowWidth - lw;
g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2) ) ); g2.fill( new Rectangle2D.Float( lx, focusWidth, lw, height - 1 - (focusWidth * 2) ) );
} }

View File

@@ -409,7 +409,7 @@ public class FlatUIUtils
* <strong>Border</strong>: * <strong>Border</strong>:
* The outside bounds of the painted border are * The outside bounds of the painted border are
* {@code [x + focusWidth, y + focusWidth, width - (focusWidth * 2), height - (focusWidth * 2)]}. * {@code [x + focusWidth, y + focusWidth, width - (focusWidth * 2), height - (focusWidth * 2)]}.
* The thickness of the painted border is {@code lineWidth}. * The thickness of the painted border is {@code borderWidth}.
* *
* @param g the graphics context used for painting * @param g the graphics context used for painting
* @param x the x coordinate of the component * @param x the x coordinate of the component
@@ -422,7 +422,7 @@ public class FlatUIUtils
* the painted thickness of the focus border is {@code (focusWidth * focusWidthFraction) + focusInnerWidth} * the painted thickness of the focus border is {@code (focusWidth * focusWidthFraction) + focusInnerWidth}
* @param focusInnerWidth the inner width of the focus border, or {@code 0}; * @param focusInnerWidth the inner width of the focus border, or {@code 0};
* if a border is painted then {@code focusInnerWidth} needs to be larger * if a border is painted then {@code focusInnerWidth} needs to be larger
* than {@code lineWidth} to be not hidden by the border * than {@code borderWidth} to be not hidden by the border
* @param borderWidth the width of the border, or {@code 0} * @param borderWidth the width of the border, or {@code 0}
* @param arc the arc diameter used for the outside shape of the component border; * @param arc the arc diameter used for the outside shape of the component border;
* the other needed arc diameters are computed from this arc diameter * the other needed arc diameters are computed from this arc diameter

View File

@@ -228,6 +228,7 @@ ComboBox.buttonPressedArrowColor = @buttonPressedArrowColor
Component.focusWidth = 0 Component.focusWidth = 0
Component.innerFocusWidth = 0.5 Component.innerFocusWidth = 0.5
Component.innerOutlineWidth = 1 Component.innerOutlineWidth = 1
Component.borderWidth = 1
Component.arc = 5 Component.arc = 5
Component.minimumWidth = 64 Component.minimumWidth = 64
# allowed values: chevron or triangle # allowed values: chevron or triangle

View File

@@ -164,6 +164,7 @@ public class TestFlatStyleableInfo
"buttonBackground", Color.class, "buttonBackground", Color.class,
"buttonFocusedBackground", Color.class, "buttonFocusedBackground", Color.class,
"buttonEditableBackground", Color.class, "buttonEditableBackground", Color.class,
"buttonSeparatorWidth", float.class,
"buttonSeparatorColor", Color.class, "buttonSeparatorColor", Color.class,
"buttonDisabledSeparatorColor", Color.class, "buttonDisabledSeparatorColor", Color.class,
"buttonArrowColor", Color.class, "buttonArrowColor", Color.class,
@@ -456,7 +457,7 @@ public class TestFlatStyleableInfo
radioButton( expected ); radioButton( expected );
expectedMap( expected, expectedMap( expected,
"icon.centerDiameter", int.class "icon.centerDiameter", float.class
); );
assertMapEquals( expected, ui.getStyleableInfos( c ) ); assertMapEquals( expected, ui.getStyleableInfos( c ) );
@@ -470,6 +471,7 @@ public class TestFlatStyleableInfo
"icon.focusWidth", int.class, "icon.focusWidth", int.class,
"icon.focusColor", Color.class, "icon.focusColor", Color.class,
"icon.borderWidth", float.class,
"icon.arc", int.class, "icon.arc", int.class,
// enabled // enabled
@@ -580,6 +582,7 @@ public class TestFlatStyleableInfo
"trackWidth", int.class, "trackWidth", int.class,
"thumbSize", Dimension.class, "thumbSize", Dimension.class,
"focusWidth", int.class, "focusWidth", int.class,
"thumbBorderWidth", float.class,
"trackValueColor", Color.class, "trackValueColor", Color.class,
"trackColor", Color.class, "trackColor", Color.class,
@@ -611,6 +614,7 @@ public class TestFlatStyleableInfo
"disabledForeground", Color.class, "disabledForeground", Color.class,
"focusedBackground", Color.class, "focusedBackground", Color.class,
"buttonBackground", Color.class, "buttonBackground", Color.class,
"buttonSeparatorWidth", float.class,
"buttonSeparatorColor", Color.class, "buttonSeparatorColor", Color.class,
"buttonDisabledSeparatorColor", Color.class, "buttonDisabledSeparatorColor", Color.class,
"buttonArrowColor", Color.class, "buttonArrowColor", Color.class,
@@ -901,23 +905,23 @@ public class TestFlatStyleableInfo
flatBorder( expected ); flatBorder( expected );
expectedMap( expected, expectedMap( expected,
"arc", int.class,
"borderColor", Color.class, "borderColor", Color.class,
"disabledBorderColor", Color.class, "disabledBorderColor", Color.class,
"focusedBorderColor", Color.class, "focusedBorderColor", Color.class,
"hoverBorderColor", Color.class, "hoverBorderColor", Color.class,
"default.borderWidth", float.class,
"default.borderColor", Color.class, "default.borderColor", Color.class,
"default.focusedBorderColor", Color.class, "default.focusedBorderColor", Color.class,
"default.focusColor", Color.class, "default.focusColor", Color.class,
"default.hoverBorderColor", Color.class, "default.hoverBorderColor", Color.class,
"toolbar.focusColor", Color.class,
"borderWidth", int.class,
"default.borderWidth", int.class,
"toolbar.margin", Insets.class,
"toolbar.spacingInsets", Insets.class,
"toolbar.focusWidth", float.class, "toolbar.focusWidth", float.class,
"arc", int.class "toolbar.focusColor", Color.class,
"toolbar.margin", Insets.class,
"toolbar.spacingInsets", Insets.class
); );
} }
@@ -946,6 +950,8 @@ public class TestFlatStyleableInfo
"focusWidth", int.class, "focusWidth", int.class,
"innerFocusWidth", float.class, "innerFocusWidth", float.class,
"innerOutlineWidth", float.class, "innerOutlineWidth", float.class,
"borderWidth", float.class,
"focusColor", Color.class, "focusColor", Color.class,
"borderColor", Color.class, "borderColor", Color.class,
"disabledBorderColor", Color.class, "disabledBorderColor", Color.class,
@@ -1026,7 +1032,7 @@ public class TestFlatStyleableInfo
flatCheckBoxIcon( expected ); flatCheckBoxIcon( expected );
expectedMap( expected, expectedMap( expected,
"centerDiameter", int.class "centerDiameter", float.class
); );
assertMapEquals( expected, icon.getStyleableInfos() ); assertMapEquals( expected, icon.getStyleableInfos() );
@@ -1036,6 +1042,7 @@ public class TestFlatStyleableInfo
expectedMap( expected, expectedMap( expected,
"focusWidth", int.class, "focusWidth", int.class,
"focusColor", Color.class, "focusColor", Color.class,
"borderWidth", float.class,
"arc", int.class, "arc", int.class,
// enabled // enabled

View File

@@ -294,6 +294,7 @@ public class TestFlatStyling
ui.applyStyle( "buttonBackground: #fff" ); ui.applyStyle( "buttonBackground: #fff" );
ui.applyStyle( "buttonFocusedBackground: #fff" ); ui.applyStyle( "buttonFocusedBackground: #fff" );
ui.applyStyle( "buttonEditableBackground: #fff" ); ui.applyStyle( "buttonEditableBackground: #fff" );
ui.applyStyle( "buttonSeparatorWidth: 1.5" );
ui.applyStyle( "buttonSeparatorColor: #fff" ); ui.applyStyle( "buttonSeparatorColor: #fff" );
ui.applyStyle( "buttonDisabledSeparatorColor: #fff" ); ui.applyStyle( "buttonDisabledSeparatorColor: #fff" );
ui.applyStyle( "buttonArrowColor: #fff" ); ui.applyStyle( "buttonArrowColor: #fff" );
@@ -609,6 +610,7 @@ public class TestFlatStyling
ui.applyStyle( b, "icon.focusWidth: 2" ); ui.applyStyle( b, "icon.focusWidth: 2" );
ui.applyStyle( b, "icon.focusColor: #fff" ); ui.applyStyle( b, "icon.focusColor: #fff" );
ui.applyStyle( b, "icon.borderWidth: 1" );
ui.applyStyle( b, "icon.arc: 5" ); ui.applyStyle( b, "icon.arc: 5" );
// enabled // enabled
@@ -719,6 +721,7 @@ public class TestFlatStyling
ui.applyStyle( "trackWidth: 2" ); ui.applyStyle( "trackWidth: 2" );
ui.applyStyle( "thumbSize: 12,12" ); ui.applyStyle( "thumbSize: 12,12" );
ui.applyStyle( "focusWidth: 4" ); ui.applyStyle( "focusWidth: 4" );
ui.applyStyle( "thumbBorderWidth: 1.5" );
ui.applyStyle( "trackValueColor: #fff" ); ui.applyStyle( "trackValueColor: #fff" );
ui.applyStyle( "trackColor: #fff" ); ui.applyStyle( "trackColor: #fff" );
@@ -769,6 +772,7 @@ public class TestFlatStyling
ui.applyStyle( "disabledForeground: #fff" ); ui.applyStyle( "disabledForeground: #fff" );
ui.applyStyle( "focusedBackground: #fff" ); ui.applyStyle( "focusedBackground: #fff" );
ui.applyStyle( "buttonBackground: #fff" ); ui.applyStyle( "buttonBackground: #fff" );
ui.applyStyle( "buttonSeparatorWidth: 1.5" );
ui.applyStyle( "buttonSeparatorColor: #fff" ); ui.applyStyle( "buttonSeparatorColor: #fff" );
ui.applyStyle( "buttonDisabledSeparatorColor: #fff" ); ui.applyStyle( "buttonDisabledSeparatorColor: #fff" );
ui.applyStyle( "buttonArrowColor: #fff" ); ui.applyStyle( "buttonArrowColor: #fff" );
@@ -1109,23 +1113,23 @@ public class TestFlatStyling
private void flatButtonBorder( Consumer<String> applyStyle ) { private void flatButtonBorder( Consumer<String> applyStyle ) {
flatBorder( applyStyle ); flatBorder( applyStyle );
applyStyle.accept( "arc: 6" );
applyStyle.accept( "borderColor: #fff" ); applyStyle.accept( "borderColor: #fff" );
applyStyle.accept( "disabledBorderColor: #fff" ); applyStyle.accept( "disabledBorderColor: #fff" );
applyStyle.accept( "focusedBorderColor: #fff" ); applyStyle.accept( "focusedBorderColor: #fff" );
applyStyle.accept( "hoverBorderColor: #fff" ); applyStyle.accept( "hoverBorderColor: #fff" );
applyStyle.accept( "default.borderWidth: 2" );
applyStyle.accept( "default.borderColor: #fff" ); applyStyle.accept( "default.borderColor: #fff" );
applyStyle.accept( "default.focusedBorderColor: #fff" ); applyStyle.accept( "default.focusedBorderColor: #fff" );
applyStyle.accept( "default.focusColor: #fff" ); applyStyle.accept( "default.focusColor: #fff" );
applyStyle.accept( "default.hoverBorderColor: #fff" ); applyStyle.accept( "default.hoverBorderColor: #fff" );
applyStyle.accept( "toolbar.focusColor: #fff" );
applyStyle.accept( "borderWidth: 1" ); applyStyle.accept( "toolbar.focusWidth: 1.5" );
applyStyle.accept( "default.borderWidth: 2" ); applyStyle.accept( "toolbar.focusColor: #fff" );
applyStyle.accept( "toolbar.margin: 1,2,3,4" ); applyStyle.accept( "toolbar.margin: 1,2,3,4" );
applyStyle.accept( "toolbar.spacingInsets: 1,2,3,4" ); applyStyle.accept( "toolbar.spacingInsets: 1,2,3,4" );
applyStyle.accept( "toolbar.focusWidth: 1.5" );
applyStyle.accept( "arc: 6" );
} }
private void flatRoundBorder( Consumer<String> applyStyle ) { private void flatRoundBorder( Consumer<String> applyStyle ) {
@@ -1148,6 +1152,8 @@ public class TestFlatStyling
applyStyle.accept( "focusWidth: 2" ); applyStyle.accept( "focusWidth: 2" );
applyStyle.accept( "innerFocusWidth: 0.5" ); applyStyle.accept( "innerFocusWidth: 0.5" );
applyStyle.accept( "innerOutlineWidth: 1.5" ); applyStyle.accept( "innerOutlineWidth: 1.5" );
applyStyle.accept( "borderWidth: 1" );
applyStyle.accept( "focusColor: #fff" ); applyStyle.accept( "focusColor: #fff" );
applyStyle.accept( "borderColor: #fff" ); applyStyle.accept( "borderColor: #fff" );
applyStyle.accept( "disabledBorderColor: #fff" ); applyStyle.accept( "disabledBorderColor: #fff" );
@@ -1173,23 +1179,23 @@ public class TestFlatStyling
// FlatButtonBorder extends FlatBorder // FlatButtonBorder extends FlatBorder
flatBorder( border ); flatBorder( border );
border.applyStyleProperty( "arc", 6 );
border.applyStyleProperty( "borderColor", Color.WHITE ); border.applyStyleProperty( "borderColor", Color.WHITE );
border.applyStyleProperty( "disabledBorderColor", Color.WHITE ); border.applyStyleProperty( "disabledBorderColor", Color.WHITE );
border.applyStyleProperty( "focusedBorderColor", Color.WHITE ); border.applyStyleProperty( "focusedBorderColor", Color.WHITE );
border.applyStyleProperty( "hoverBorderColor", Color.WHITE ); border.applyStyleProperty( "hoverBorderColor", Color.WHITE );
border.applyStyleProperty( "default.borderWidth", 2 );
border.applyStyleProperty( "default.borderColor", Color.WHITE ); border.applyStyleProperty( "default.borderColor", Color.WHITE );
border.applyStyleProperty( "default.focusedBorderColor", Color.WHITE ); border.applyStyleProperty( "default.focusedBorderColor", Color.WHITE );
border.applyStyleProperty( "default.focusColor", Color.WHITE ); border.applyStyleProperty( "default.focusColor", Color.WHITE );
border.applyStyleProperty( "default.hoverBorderColor", Color.WHITE ); border.applyStyleProperty( "default.hoverBorderColor", Color.WHITE );
border.applyStyleProperty( "toolbar.focusColor", Color.WHITE );
border.applyStyleProperty( "borderWidth", 1 ); border.applyStyleProperty( "toolbar.focusWidth", 1.5f );
border.applyStyleProperty( "default.borderWidth", 2 ); border.applyStyleProperty( "toolbar.focusColor", Color.WHITE );
border.applyStyleProperty( "toolbar.margin", new Insets( 1, 2, 3, 4 ) ); border.applyStyleProperty( "toolbar.margin", new Insets( 1, 2, 3, 4 ) );
border.applyStyleProperty( "toolbar.spacingInsets", new Insets( 1, 2, 3, 4 ) ); border.applyStyleProperty( "toolbar.spacingInsets", new Insets( 1, 2, 3, 4 ) );
border.applyStyleProperty( "toolbar.focusWidth", 1.5f );
border.applyStyleProperty( "arc", 6 );
} }
@Test @Test
@@ -1223,6 +1229,8 @@ public class TestFlatStyling
border.applyStyleProperty( "focusWidth", 2 ); border.applyStyleProperty( "focusWidth", 2 );
border.applyStyleProperty( "innerFocusWidth", 0.5f ); border.applyStyleProperty( "innerFocusWidth", 0.5f );
border.applyStyleProperty( "innerOutlineWidth", 1.5f ); border.applyStyleProperty( "innerOutlineWidth", 1.5f );
border.applyStyleProperty( "borderWidth", 1 );
border.applyStyleProperty( "focusColor", Color.WHITE ); border.applyStyleProperty( "focusColor", Color.WHITE );
border.applyStyleProperty( "borderColor", Color.WHITE ); border.applyStyleProperty( "borderColor", Color.WHITE );
border.applyStyleProperty( "disabledBorderColor", Color.WHITE ); border.applyStyleProperty( "disabledBorderColor", Color.WHITE );
@@ -1251,12 +1259,13 @@ public class TestFlatStyling
// FlatRadioButtonIcon extends FlatCheckBoxIcon // FlatRadioButtonIcon extends FlatCheckBoxIcon
flatCheckBoxIcon( icon ); flatCheckBoxIcon( icon );
icon.applyStyleProperty( "centerDiameter", 8 ); icon.applyStyleProperty( "centerDiameter", 8f );
} }
private void flatCheckBoxIcon( FlatCheckBoxIcon icon ) { private void flatCheckBoxIcon( FlatCheckBoxIcon icon ) {
icon.applyStyleProperty( "focusWidth", 2 ); icon.applyStyleProperty( "focusWidth", 2 );
icon.applyStyleProperty( "focusColor", Color.WHITE ); icon.applyStyleProperty( "focusColor", Color.WHITE );
icon.applyStyleProperty( "borderWidth", 1.5f );
icon.applyStyleProperty( "arc", 5 ); icon.applyStyleProperty( "arc", 5 );
// enabled // enabled

View File

@@ -224,6 +224,7 @@ Component.accentColor #4b6eaf HSL 219 40 49 javax.swing.plaf.Colo
Component.arc 5 Component.arc 5
Component.arrowType chevron Component.arrowType chevron
Component.borderColor #616365 HSL 210 2 39 javax.swing.plaf.ColorUIResource [UI] Component.borderColor #616365 HSL 210 2 39 javax.swing.plaf.ColorUIResource [UI]
Component.borderWidth 1
Component.custom.borderColor #bf4040 HSL 0 50 50 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(50% relative) Component.custom.borderColor #bf4040 HSL 0 50 50 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(50% relative)
Component.disabledBorderColor #616365 HSL 210 2 39 javax.swing.plaf.ColorUIResource [UI] Component.disabledBorderColor #616365 HSL 210 2 39 javax.swing.plaf.ColorUIResource [UI]
Component.error.borderColor #725555 HSL 0 15 39 javax.swing.plaf.ColorUIResource [UI] Component.error.borderColor #725555 HSL 0 15 39 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -228,6 +228,7 @@ Component.accentColor #2675bf HSL 209 67 45 javax.swing.plaf.Colo
Component.arc 5 Component.arc 5
Component.arrowType chevron Component.arrowType chevron
Component.borderColor #c2c2c2 HSL 0 0 76 javax.swing.plaf.ColorUIResource [UI] Component.borderColor #c2c2c2 HSL 0 0 76 javax.swing.plaf.ColorUIResource [UI]
Component.borderWidth 1
Component.custom.borderColor #f38d8d HSL 0 81 75 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%) Component.custom.borderColor #f38d8d HSL 0 81 75 com.formdev.flatlaf.util.DerivedColor [UI] desaturate(20%) lighten(25%)
Component.disabledBorderColor #cecece HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI] Component.disabledBorderColor #cecece HSL 0 0 81 javax.swing.plaf.ColorUIResource [UI]
Component.error.borderColor #ebb8bc HSL 355 56 82 javax.swing.plaf.ColorUIResource [UI] Component.error.borderColor #ebb8bc HSL 355 56 82 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -227,6 +227,7 @@ ComboBoxUI com.formdev.flatlaf.ui.FlatComboBoxUI
Component.arc 5 Component.arc 5
Component.arrowType chevron Component.arrowType chevron
Component.borderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Component.borderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
Component.borderWidth 1
Component.disabledBorderColor #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI] Component.disabledBorderColor #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI]
Component.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] Component.focusColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI]
Component.focusWidth 0 Component.focusWidth 0
@@ -919,6 +920,7 @@ Slider.focus #696969 HSL 0 0 41 javax.swing.plaf.Colo
Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] Slider.focusInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI]
Slider.focusWidth 4 Slider.focusWidth 4
Slider.focusedColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI] Slider.focusedColor #97c3f3 HSL 211 79 77 javax.swing.plaf.ColorUIResource [UI]
Slider.focusedThumbBorderColor #00ff00 HSL 120 100 50 javax.swing.plaf.ColorUIResource [UI]
Slider.font [active] $defaultFont [UI] Slider.font [active] $defaultFont [UI]
Slider.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Slider.foreground #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
Slider.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI] Slider.highlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
@@ -932,6 +934,7 @@ Slider.pressedThumbColor #00ff00 HSL 120 100 50 javax.swing.plaf.Colo
Slider.pressedTrackColor #88ff88 HSL 120 100 77 javax.swing.plaf.ColorUIResource [UI] Slider.pressedTrackColor #88ff88 HSL 120 100 77 javax.swing.plaf.ColorUIResource [UI]
Slider.shadow #a0a0a0 HSL 0 0 63 javax.swing.plaf.ColorUIResource [UI] Slider.shadow #a0a0a0 HSL 0 0 63 javax.swing.plaf.ColorUIResource [UI]
Slider.thumbBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Slider.thumbBorderColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
Slider.thumbBorderWidth 1.5
Slider.thumbColor #ffaaaa HSL 0 100 83 javax.swing.plaf.ColorUIResource [UI] Slider.thumbColor #ffaaaa HSL 0 100 83 javax.swing.plaf.ColorUIResource [UI]
Slider.thumbSize 12,12 javax.swing.plaf.DimensionUIResource [UI] Slider.thumbSize 12,12 javax.swing.plaf.DimensionUIResource [UI]
Slider.tickColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI] Slider.tickColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]

View File

@@ -303,8 +303,10 @@ Separator.stripeIndent = 5
Slider.trackColor = #8f8 Slider.trackColor = #8f8
Slider.thumbColor = #faa Slider.thumbColor = #faa
Slider.thumbBorderColor = #f00 Slider.thumbBorderColor = #f00
Slider.thumbBorderWidth = 1.5
Slider.tickColor = #f00 Slider.tickColor = #f00
Slider.focusedColor = $Component.focusColor Slider.focusedColor = $Component.focusColor
Slider.focusedThumbBorderColor = #0f0
Slider.hoverThumbColor = #00f Slider.hoverThumbColor = #00f
Slider.pressedThumbColor = #0f0 Slider.pressedThumbColor = #0f0
Slider.disabledTrackColor = #ff8 Slider.disabledTrackColor = #ff8

View File

@@ -76,6 +76,7 @@ CheckBox.foreground
CheckBox.icon CheckBox.icon
CheckBox.icon.background CheckBox.icon.background
CheckBox.icon.borderColor CheckBox.icon.borderColor
CheckBox.icon.borderWidth
CheckBox.icon.checkmarkColor CheckBox.icon.checkmarkColor
CheckBox.icon.disabledBackground CheckBox.icon.disabledBackground
CheckBox.icon.disabledBorderColor CheckBox.icon.disabledBorderColor
@@ -158,6 +159,7 @@ ComboBox.buttonHighlight
ComboBox.buttonHoverArrowColor ComboBox.buttonHoverArrowColor
ComboBox.buttonPressedArrowColor ComboBox.buttonPressedArrowColor
ComboBox.buttonSeparatorColor ComboBox.buttonSeparatorColor
ComboBox.buttonSeparatorWidth
ComboBox.buttonShadow ComboBox.buttonShadow
ComboBox.buttonStyle ComboBox.buttonStyle
ComboBox.disabledBackground ComboBox.disabledBackground
@@ -180,6 +182,7 @@ Component.accentColor
Component.arc Component.arc
Component.arrowType Component.arrowType
Component.borderColor Component.borderColor
Component.borderWidth
Component.custom.borderColor Component.custom.borderColor
Component.disabledBorderColor Component.disabledBorderColor
Component.error.borderColor Component.error.borderColor
@@ -687,6 +690,7 @@ Slider.focusInputMap.RightToLeft
Slider.focusInsets Slider.focusInsets
Slider.focusWidth Slider.focusWidth
Slider.focusedColor Slider.focusedColor
Slider.focusedThumbBorderColor
Slider.font Slider.font
Slider.foreground Slider.foreground
Slider.highlight Slider.highlight
@@ -700,6 +704,7 @@ Slider.pressedThumbColor
Slider.pressedTrackColor Slider.pressedTrackColor
Slider.shadow Slider.shadow
Slider.thumbBorderColor Slider.thumbBorderColor
Slider.thumbBorderWidth
Slider.thumbColor Slider.thumbColor
Slider.thumbSize Slider.thumbSize
Slider.tickColor Slider.tickColor
@@ -719,6 +724,7 @@ Spinner.buttonDisabledSeparatorColor
Spinner.buttonHoverArrowColor Spinner.buttonHoverArrowColor
Spinner.buttonPressedArrowColor Spinner.buttonPressedArrowColor
Spinner.buttonSeparatorColor Spinner.buttonSeparatorColor
Spinner.buttonSeparatorWidth
Spinner.buttonStyle Spinner.buttonStyle
Spinner.disabledBackground Spinner.disabledBackground
Spinner.disabledForeground Spinner.disabledForeground