mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Button and ToggleButton:
- updated CHANGELOG.md for #276 - FlatComponentsTest: use FlatButton and FlatToggleButton - FlatButtonUI: avoid unnecessary reading client property if shadowColor is null, which is the case in most themes
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
FlatLaf Change Log
|
FlatLaf Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## 1.2-SNAPSHOT
|
||||||
|
|
||||||
|
#### New features and improvements
|
||||||
|
|
||||||
|
- Button and ToggleButton: Support borderless button style (set client property
|
||||||
|
`JButton.buttonType` to `borderless`). (PR #276)
|
||||||
|
|
||||||
|
|
||||||
## 1.1.2
|
## 1.1.2
|
||||||
|
|
||||||
#### New features and improvements
|
#### New features and improvements
|
||||||
|
|||||||
@@ -336,8 +336,9 @@ 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( shadowColor != null && shadowWidth > 0 && focusWidth > 0 && c.isEnabled() &&
|
||||||
!(isFocusPainted( c ) && FlatUIUtils.isPermanentFocusOwner( c )) && c.isEnabled() )
|
!isToolBarButton && !isBorderlessButton( c ) &&
|
||||||
|
!(isFocusPainted( c ) && FlatUIUtils.isPermanentFocusOwner( c )) )
|
||||||
{
|
{
|
||||||
g2.setColor( shadowColor );
|
g2.setColor( shadowColor );
|
||||||
g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ),
|
g2.fill( new RoundRectangle2D.Float( focusWidth, focusWidth + UIScale.scale( (float) shadowWidth ),
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ public class FlatComponentsTest
|
|||||||
JButton button16 = new JButton();
|
JButton button16 = new JButton();
|
||||||
JButton button24 = new JButton();
|
JButton button24 = new JButton();
|
||||||
JButton button20 = new JButton();
|
JButton button20 = new JButton();
|
||||||
JButton button25 = new JButton();
|
FlatButton button25 = new FlatButton();
|
||||||
JLabel toggleButtonLabel = new JLabel();
|
JLabel toggleButtonLabel = new JLabel();
|
||||||
JToggleButton toggleButton1 = new JToggleButton();
|
JToggleButton toggleButton1 = new JToggleButton();
|
||||||
FlatToggleButton toggleButton9 = new FlatToggleButton();
|
FlatToggleButton toggleButton9 = new FlatToggleButton();
|
||||||
@@ -269,7 +269,7 @@ public class FlatComponentsTest
|
|||||||
JToggleButton toggleButton14 = new JToggleButton();
|
JToggleButton toggleButton14 = new JToggleButton();
|
||||||
JToggleButton toggleButton21 = new JToggleButton();
|
JToggleButton toggleButton21 = new JToggleButton();
|
||||||
JToggleButton toggleButton18 = new JToggleButton();
|
JToggleButton toggleButton18 = new JToggleButton();
|
||||||
JToggleButton toggleButton22 = new JToggleButton();
|
FlatToggleButton toggleButton22 = new FlatToggleButton();
|
||||||
JLabel checkBoxLabel = new JLabel();
|
JLabel checkBoxLabel = new JLabel();
|
||||||
JCheckBox checkBox1 = new JCheckBox();
|
JCheckBox checkBox1 = new JCheckBox();
|
||||||
JCheckBox checkBox2 = new JCheckBox();
|
JCheckBox checkBox2 = new JCheckBox();
|
||||||
@@ -582,7 +582,7 @@ public class FlatComponentsTest
|
|||||||
|
|
||||||
//---- button25 ----
|
//---- button25 ----
|
||||||
button25.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
button25.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||||
button25.putClientProperty("JButton.buttonType", "borderLess");
|
button25.setButtonType(FlatButton.ButtonType.borderless);
|
||||||
add(button25, "cell 5 1 2 1");
|
add(button25, "cell 5 1 2 1");
|
||||||
|
|
||||||
//---- toggleButtonLabel ----
|
//---- toggleButtonLabel ----
|
||||||
@@ -665,7 +665,7 @@ public class FlatComponentsTest
|
|||||||
//---- toggleButton22 ----
|
//---- toggleButton22 ----
|
||||||
toggleButton22.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
toggleButton22.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||||
toggleButton22.setSelected(true);
|
toggleButton22.setSelected(true);
|
||||||
toggleButton22.putClientProperty("JButton.buttonType", "borderLess");
|
toggleButton22.setButtonType(FlatButton.ButtonType.borderless);
|
||||||
add(toggleButton22, "cell 5 2 2 1");
|
add(toggleButton22, "cell 5 2 2 1");
|
||||||
|
|
||||||
//---- checkBoxLabel ----
|
//---- checkBoxLabel ----
|
||||||
|
|||||||
@@ -156,10 +156,10 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 5 1 2 1"
|
"value": "cell 5 1 2 1"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatButton" ) {
|
||||||
name: "button25"
|
name: "button25"
|
||||||
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
|
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
|
||||||
"$client.JButton.buttonType": "borderLess"
|
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType borderless
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 5 1 2 1"
|
"value": "cell 5 1 2 1"
|
||||||
} )
|
} )
|
||||||
@@ -270,11 +270,11 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 5 2 2 1"
|
"value": "cell 5 2 2 1"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JToggleButton" ) {
|
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatToggleButton" ) {
|
||||||
name: "toggleButton22"
|
name: "toggleButton22"
|
||||||
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
|
"icon": &SwingIcon0 new com.jformdesigner.model.SwingIcon( 2, "Tree.closedIcon" )
|
||||||
"selected": true
|
"selected": true
|
||||||
"$client.JButton.buttonType": "borderLess"
|
"buttonType": enum com.formdev.flatlaf.extras.components.FlatButton$ButtonType borderless
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 5 2 2 1"
|
"value": "cell 5 2 2 1"
|
||||||
} )
|
} )
|
||||||
|
|||||||
Reference in New Issue
Block a user