diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a4909e1..fe1850e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ FlatLaf Change Log - 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 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 `META-INF/versions/9`). But FlatLaf remains Java 8 compatible. (issue #1) - Support specifying custom scale factor in system properties `flatlaf.uiScale` diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java index e7b322ac..61454f7d 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatBorder.java @@ -73,17 +73,17 @@ public class FlatBorder FlatUIUtils.setRenderingHints( g2 ); float focusWidth = getFocusWidth(); - float lineWidth = getLineWidth(); + float borderWidth = getBorderWidth( c ); float arc = getArc(); if( isFocused( c ) ) { g2.setColor( getFocusColor( c ) ); FlatUIUtils.paintOutlineBorder( g2, x, y, width, height, focusWidth, - lineWidth + scale( (float) innerFocusWidth ), arc ); + getLineWidth() + scale( (float) innerFocusWidth ), arc ); } 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 { g2.dispose(); } @@ -152,6 +152,10 @@ public class FlatBorder return scale( 1f ); } + protected float getBorderWidth( Component c ) { + return getLineWidth(); + } + protected float getArc() { return 0; } diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java index 5a982baf..424679ef 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatButtonBorder.java @@ -37,6 +37,7 @@ import javax.swing.plaf.UIResource; * @uiDefault Button.default.hoverBorderColor Color optional * @uiDefault Button.default.focusedBorderColor Color * @uiDefault Button.default.focusColor Color + * @uiDefault Button.default.borderWidth int * @uiDefault Button.arc int * * @author Karl Tauber @@ -52,6 +53,7 @@ public class FlatButtonBorder protected final Color defaultHoverBorderColor = UIManager.getColor( "Button.default.hoverBorderColor" ); protected final Color defaultFocusedBorderColor = UIManager.getColor( "Button.default.focusedBorderColor" ); 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" ); @Override @@ -87,6 +89,11 @@ public class FlatButtonBorder return insets; } + @Override + protected float getBorderWidth( Component c ) { + return FlatButtonUI.isDefaultButton( c ) ? scale( (float) defaultBorderWidth ) : super.getBorderWidth( c ); + } + @Override protected float getArc() { return scale( (float) arc ); diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index 45ef756c..b3877358 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -79,6 +79,7 @@ Button.default.borderColor=4c708c Button.default.hoverBorderColor=537699 Button.default.focusedBorderColor=537699 Button.default.focusColor=43688c +Button.default.boldText=true Button.toolbar.hoverBackground=4c5052 Button.toolbar.pressedBackground=555a5d diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties index f4a9fd21..d58e3903 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatIntelliJLaf.properties @@ -22,6 +22,15 @@ 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 diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index 3343a83f..3f5a2647 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -70,6 +70,8 @@ Button.iconTextGap=4 Button.rollover=true Button.defaultButtonFollowsFocus=false +Button.default.borderWidth=1 + #---- CheckBox ---- diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties index 13febefc..c7cdde4a 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLightLaf.properties @@ -72,14 +72,16 @@ Button.disabledBorderColor=cfcfcf Button.focusedBorderColor=87afda Button.hoverBorderColor=@@Button.focusedBorderColor -Button.default.background=4A86C7 -Button.default.foreground=f0f0f0 -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.background=@@Button.background +Button.default.foreground=@foreground +Button.default.focusedBackground=@@Button.focusedBackground +Button.default.hoverBackground=@@Button.hoverBackground +Button.default.pressedBackground=@@Button.pressedBackground +Button.default.borderColor=4D89C9 +Button.default.hoverBorderColor=@@Button.hoverBorderColor +Button.default.focusedBorderColor=@@Button.focusedBorderColor +Button.default.focusColor=@@Component.focusColor +Button.default.borderWidth=2 Button.toolbar.hoverBackground=dfdfdf Button.toolbar.pressedBackground=d8d8d8