mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
Button: changed styling of default button in "Flat Light" theme (wide blue border instead of blue background)
This commit is contained in:
@@ -12,6 +12,8 @@ FlatLaf Change Log
|
|||||||
- If a JButton has an icon and no text, then it does not get a minimum width
|
- If a JButton has an icon and no text, then it does not get a minimum width
|
||||||
(usually 72 pixel) and the left and right insets are same as top/bottom insets
|
(usually 72 pixel) and the left and right insets are same as top/bottom insets
|
||||||
so that it becomes square (if the icon is square).
|
so that it becomes square (if the icon is square).
|
||||||
|
- Changed styling of default button in "Flat Light" theme (wide blue border
|
||||||
|
instead of blue background).
|
||||||
- Added Java 9 module descriptor `module-info.class` to `flatlaf.jar` (in
|
- Added Java 9 module descriptor `module-info.class` to `flatlaf.jar` (in
|
||||||
`META-INF/versions/9`). But FlatLaf remains Java 8 compatible. (issue #1)
|
`META-INF/versions/9`). But FlatLaf remains Java 8 compatible. (issue #1)
|
||||||
- Support specifying custom scale factor in system properties `flatlaf.uiScale`
|
- Support specifying custom scale factor in system properties `flatlaf.uiScale`
|
||||||
|
|||||||
@@ -73,17 +73,17 @@ public class FlatBorder
|
|||||||
FlatUIUtils.setRenderingHints( g2 );
|
FlatUIUtils.setRenderingHints( g2 );
|
||||||
|
|
||||||
float focusWidth = getFocusWidth();
|
float focusWidth = getFocusWidth();
|
||||||
float lineWidth = getLineWidth();
|
float borderWidth = getBorderWidth( c );
|
||||||
float arc = getArc();
|
float arc = getArc();
|
||||||
|
|
||||||
if( isFocused( c ) ) {
|
if( isFocused( c ) ) {
|
||||||
g2.setColor( getFocusColor( c ) );
|
g2.setColor( getFocusColor( c ) );
|
||||||
FlatUIUtils.paintOutlineBorder( g2, x, y, width, height, focusWidth,
|
FlatUIUtils.paintOutlineBorder( g2, x, y, width, height, focusWidth,
|
||||||
lineWidth + scale( (float) innerFocusWidth ), arc );
|
getLineWidth() + scale( (float) innerFocusWidth ), arc );
|
||||||
}
|
}
|
||||||
|
|
||||||
g2.setPaint( getBorderColor( c ) );
|
g2.setPaint( getBorderColor( c ) );
|
||||||
FlatUIUtils.drawRoundRectangle( g2, x, y, width, height, focusWidth, lineWidth, arc );
|
FlatUIUtils.drawRoundRectangle( g2, x, y, width, height, focusWidth, borderWidth, arc );
|
||||||
} finally {
|
} finally {
|
||||||
g2.dispose();
|
g2.dispose();
|
||||||
}
|
}
|
||||||
@@ -152,6 +152,10 @@ public class FlatBorder
|
|||||||
return scale( 1f );
|
return scale( 1f );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected float getBorderWidth( Component c ) {
|
||||||
|
return getLineWidth();
|
||||||
|
}
|
||||||
|
|
||||||
protected float getArc() {
|
protected float getArc() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import javax.swing.plaf.UIResource;
|
|||||||
* @uiDefault Button.default.hoverBorderColor Color optional
|
* @uiDefault Button.default.hoverBorderColor Color optional
|
||||||
* @uiDefault Button.default.focusedBorderColor Color
|
* @uiDefault Button.default.focusedBorderColor Color
|
||||||
* @uiDefault Button.default.focusColor Color
|
* @uiDefault Button.default.focusColor Color
|
||||||
|
* @uiDefault Button.default.borderWidth int
|
||||||
* @uiDefault Button.arc int
|
* @uiDefault Button.arc int
|
||||||
*
|
*
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
@@ -52,6 +53,7 @@ public class FlatButtonBorder
|
|||||||
protected final Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" );
|
protected final Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" );
|
||||||
protected final Color defaultFocusedBorderColor = UIManager.getColor( "Button.default.focusedBorderColor" );
|
protected final Color defaultFocusedBorderColor = UIManager.getColor( "Button.default.focusedBorderColor" );
|
||||||
protected final Color defaultFocusColor = UIManager.getColor( "Button.default.focusColor" );
|
protected final Color defaultFocusColor = UIManager.getColor( "Button.default.focusColor" );
|
||||||
|
protected final int defaultBorderWidth = UIManager.getInt( "Button.default.borderWidth" );
|
||||||
protected final int arc = UIManager.getInt( "Button.arc" );
|
protected final int arc = UIManager.getInt( "Button.arc" );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,6 +89,11 @@ public class FlatButtonBorder
|
|||||||
return insets;
|
return insets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getBorderWidth( Component c ) {
|
||||||
|
return FlatButtonUI.isDefaultButton( c ) ? scale( (float) defaultBorderWidth ) : super.getBorderWidth( c );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float getArc() {
|
protected float getArc() {
|
||||||
return scale( (float) arc );
|
return scale( (float) arc );
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ Button.default.borderColor=4c708c
|
|||||||
Button.default.hoverBorderColor=537699
|
Button.default.hoverBorderColor=537699
|
||||||
Button.default.focusedBorderColor=537699
|
Button.default.focusedBorderColor=537699
|
||||||
Button.default.focusColor=43688c
|
Button.default.focusColor=43688c
|
||||||
|
Button.default.boldText=true
|
||||||
|
|
||||||
Button.toolbar.hoverBackground=4c5052
|
Button.toolbar.hoverBackground=4c5052
|
||||||
Button.toolbar.pressedBackground=555a5d
|
Button.toolbar.pressedBackground=555a5d
|
||||||
|
|||||||
@@ -22,6 +22,15 @@
|
|||||||
|
|
||||||
Button.focusedBackground=null
|
Button.focusedBackground=null
|
||||||
|
|
||||||
|
Button.default.background=4A86C7
|
||||||
|
Button.default.foreground=f0f0f0
|
||||||
|
Button.default.focusedBackground=null
|
||||||
|
Button.default.hoverBackground=5B91CC
|
||||||
|
Button.default.pressedBackground=6E9ED2
|
||||||
|
Button.default.borderColor=3167ad
|
||||||
|
Button.default.hoverBorderColor=a8cef6
|
||||||
|
Button.default.focusedBorderColor=a8cef6
|
||||||
|
Button.default.focusColor=97c3f3
|
||||||
Button.default.boldText=true
|
Button.default.boldText=true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ Button.iconTextGap=4
|
|||||||
Button.rollover=true
|
Button.rollover=true
|
||||||
Button.defaultButtonFollowsFocus=false
|
Button.defaultButtonFollowsFocus=false
|
||||||
|
|
||||||
|
Button.default.borderWidth=1
|
||||||
|
|
||||||
|
|
||||||
#---- CheckBox ----
|
#---- CheckBox ----
|
||||||
|
|
||||||
|
|||||||
@@ -72,14 +72,16 @@ Button.disabledBorderColor=cfcfcf
|
|||||||
Button.focusedBorderColor=87afda
|
Button.focusedBorderColor=87afda
|
||||||
Button.hoverBorderColor=@@Button.focusedBorderColor
|
Button.hoverBorderColor=@@Button.focusedBorderColor
|
||||||
|
|
||||||
Button.default.background=4A86C7
|
Button.default.background=@@Button.background
|
||||||
Button.default.foreground=f0f0f0
|
Button.default.foreground=@foreground
|
||||||
Button.default.hoverBackground=5B91CC
|
Button.default.focusedBackground=@@Button.focusedBackground
|
||||||
Button.default.pressedBackground=6E9ED2
|
Button.default.hoverBackground=@@Button.hoverBackground
|
||||||
Button.default.borderColor=3167ad
|
Button.default.pressedBackground=@@Button.pressedBackground
|
||||||
Button.default.hoverBorderColor=a8cef6
|
Button.default.borderColor=4D89C9
|
||||||
Button.default.focusedBorderColor=a8cef6
|
Button.default.hoverBorderColor=@@Button.hoverBorderColor
|
||||||
Button.default.focusColor=97c3f3
|
Button.default.focusedBorderColor=@@Button.focusedBorderColor
|
||||||
|
Button.default.focusColor=@@Component.focusColor
|
||||||
|
Button.default.borderWidth=2
|
||||||
|
|
||||||
Button.toolbar.hoverBackground=dfdfdf
|
Button.toolbar.hoverBackground=dfdfdf
|
||||||
Button.toolbar.pressedBackground=d8d8d8
|
Button.toolbar.pressedBackground=d8d8d8
|
||||||
|
|||||||
Reference in New Issue
Block a user