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 5f943bfe..4ebc554d 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 @@ -18,6 +18,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Color; +import java.awt.Insets; import javax.swing.JFormattedTextField; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; @@ -61,6 +62,27 @@ public class FlatFormattedTextField } + /** + * Returns the padding of the text. + * + * @since 1.4 + */ + public Insets getPadding() { + return (Insets) getClientProperty( TEXT_FIELD_PADDING ); + } + + /** + * Specifies the padding of the text. + * This changes the location and size of the text view within the component bounds, + * but does not affect the size of the component. + * + * @since 1.4 + */ + public void setPadding( Insets padding ) { + putClientProperty( TEXT_FIELD_PADDING, padding ); + } + + /** * Returns minimum width of a component. */ 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 93b88299..86495da2 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 @@ -18,6 +18,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Color; +import java.awt.Insets; import javax.swing.JPasswordField; import com.formdev.flatlaf.extras.components.FlatTextField.SelectAllOnFocusPolicy; @@ -61,6 +62,27 @@ public class FlatPasswordField } + /** + * Returns the padding of the text. + * + * @since 1.4 + */ + public Insets getPadding() { + return (Insets) getClientProperty( TEXT_FIELD_PADDING ); + } + + /** + * Specifies the padding of the text. + * This changes the location and size of the text view within the component bounds, + * but does not affect the size of the component. + * + * @since 1.4 + */ + public void setPadding( Insets padding ) { + putClientProperty( TEXT_FIELD_PADDING, padding ); + } + + /** * Returns minimum width of a component. */ 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 a43d195b..bfa22dd2 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 @@ -18,6 +18,7 @@ package com.formdev.flatlaf.extras.components; import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Color; +import java.awt.Insets; import javax.swing.JTextField; /** @@ -63,6 +64,27 @@ public class FlatTextField } + /** + * Returns the padding of the text. + * + * @since 1.4 + */ + public Insets getPadding() { + return (Insets) getClientProperty( TEXT_FIELD_PADDING ); + } + + /** + * Specifies the padding of the text. + * This changes the location and size of the text view within the component bounds, + * but does not affect the size of the component. + * + * @since 1.4 + */ + public void setPadding( Insets padding ) { + putClientProperty( TEXT_FIELD_PADDING, padding ); + } + + /** * Returns minimum width of a component. */