diff --git a/CHANGELOG.md b/CHANGELOG.md index b81d9237..a766914f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ FlatLaf Change Log #### New features and improvements +- Extras: Added standard component extension classes that provides easy access + to FlatLaf specific client properties (see package + `com.formdev.flatlaf.extras.components`). - Extras: Renamed tri-state check box class from `com.formdev.flatlaf.extras.TriStateCheckBox` to `com.formdev.flatlaf.extras.components.FlatTriStateCheckBox`. diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java index 73a8cdc5..96831b16 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/FlatClientProperties.java @@ -130,6 +130,15 @@ public interface FlatClientProperties */ String MINIMUM_HEIGHT = "JComponent.minimumHeight"; + /** + * Paint the component with round edges. + *

+ * Components {@link javax.swing.JComboBox}, {@link javax.swing.JSpinner}, + * {@link javax.swing.JTextField}, {@link javax.swing.JFormattedTextField} and {@link javax.swing.JPasswordField}
+ * Value type {@link java.lang.Boolean} + */ + String COMPONENT_ROUND_RECT = "JComponent.roundRect"; + /** * Specifies the outline color of the component border. *

@@ -161,15 +170,6 @@ public interface FlatClientProperties */ String OUTLINE_WARNING = "warning"; - /** - * Paint the component with round edges. - *

- * Components {@link javax.swing.JComboBox}, {@link javax.swing.JSpinner}, - * {@link javax.swing.JTextField}, {@link javax.swing.JFormattedTextField} and {@link javax.swing.JPasswordField}
- * Value type {@link java.lang.Boolean} - */ - String COMPONENT_ROUND_RECT = "JComponent.roundRect"; - //---- Popup -------------------------------------------------------------- /** diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatButton.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatButton.java index d76eba16..63ede0b4 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatButton.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatButton.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JButton; /** @@ -91,4 +92,29 @@ public class FlatButton public void setMinimumHeight( int minimumHeight ) { putClientProperty( MINIMUM_HEIGHT, (minimumHeight >= 0) ? minimumHeight : null ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java index 316484cf..6b9581c7 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatComboBox.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JComboBox; /** @@ -71,4 +72,29 @@ public class FlatComboBox public void setRoundRect( boolean roundRect ) { putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java index f481f5cc..5f943bfe 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatFormattedTextField.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JFormattedTextField; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; @@ -88,4 +89,29 @@ public class FlatFormattedTextField public void setRoundRect( boolean roundRect ) { putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java index a5ba8c17..93b88299 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatPasswordField.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JPasswordField; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; @@ -88,4 +89,29 @@ public class FlatPasswordField public void setRoundRect( boolean roundRect ) { putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java index ed0ef473..159b477d 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatScrollPane.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JScrollPane; /** @@ -56,4 +57,29 @@ public class FlatScrollPane public void setSmoothScrolling( boolean smoothScrolling ) { putClientProperty( SCROLL_PANE_SMOOTH_SCROLLING, smoothScrolling ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatSpinner.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatSpinner.java index 109a7ecf..f4e162f0 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatSpinner.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatSpinner.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JSpinner; /** @@ -56,4 +57,29 @@ public class FlatSpinner public void setRoundRect( boolean roundRect ) { putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java index 7604c093..a43d195b 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTextField.java @@ -17,6 +17,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; +import java.awt.Color; import javax.swing.JTextField; /** @@ -90,4 +91,29 @@ public class FlatTextField public void setRoundRect( boolean roundRect ) { putClientPropertyBoolean( COMPONENT_ROUND_RECT, roundRect, false ); } + + + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } } diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatToggleButton.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatToggleButton.java index 3bccdd6e..a342f890 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatToggleButton.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatToggleButton.java @@ -92,6 +92,31 @@ public class FlatToggleButton } + /** + * Returns the outline color of the component border. + */ + public Object getOutline() { + return getClientProperty( OUTLINE ); + } + + /** + * Specifies the outline color of the component border. + *

+ * Allowed Values are: + *

+ */ + public void setOutline( Object outline ) { + putClientProperty( OUTLINE, outline ); + } + + /** * Returns height of underline if toggle button type is {@link ButtonType#tab}. */