Package com.formdev.flatlaf.ui
Class MigLayoutVisualPadding
- java.lang.Object
-
- com.formdev.flatlaf.ui.MigLayoutVisualPadding
-
public class MigLayoutVisualPadding extends java.lang.Object
Support for MigLayout visual paddings. Visual paddings are used by MigLayout to ignore the usually invisible space around some components (e.g. buttons) that is used to paint a focus border.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MigLayoutVisualPadding.FlatMigInsets
Marker class to identify our visual paddings and leave paddings set from outside untouched.private static interface
MigLayoutVisualPadding.FlatMigListener
Marker interface needed for listener removal.
-
Field Summary
Fields Modifier and Type Field Description private static boolean
migLayoutAvailable
static java.lang.String
VISUAL_PADDING_PROPERTY
Key of visual padding client property.private static MigLayoutVisualPadding.FlatMigInsets
ZERO
-
Constructor Summary
Constructors Constructor Description MigLayoutVisualPadding()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
install(javax.swing.JComponent c)
Convenience method that checks whether component border is a FlatBorder.static void
install(javax.swing.JComponent c, java.awt.Insets insets)
Sets the client property to the given insets.static void
install(javax.swing.JComponent c, java.util.function.Function<javax.swing.JComponent,java.awt.Insets> getPaddingFunction, java.lang.String... propertyNames)
Invokes the given function to retrieve the actual visual paddings and sets the client property.private static void
setVisualPadding(javax.swing.JComponent c, java.awt.Insets visualPadding)
static void
uninstall(javax.swing.JComponent c)
Removes listeners and restores client property.
-
-
-
Field Detail
-
VISUAL_PADDING_PROPERTY
public static java.lang.String VISUAL_PADDING_PROPERTY
Key of visual padding client property. Value must be either an integer array of size 4, or java.awt.Insets. Same as net.miginfocom.layout.PlatformDefaults.VISUAL_PADDING_PROPERTY, but we don't want to depend on miglayout library.
-
ZERO
private static final MigLayoutVisualPadding.FlatMigInsets ZERO
-
migLayoutAvailable
private static final boolean migLayoutAvailable
-
-
Method Detail
-
install
public static void install(javax.swing.JComponent c, java.awt.Insets insets)
Sets the client property to the given insets.
-
install
public static void install(javax.swing.JComponent c)
Convenience method that checks whether component border is a FlatBorder.
-
install
public static void install(javax.swing.JComponent c, java.util.function.Function<javax.swing.JComponent,java.awt.Insets> getPaddingFunction, java.lang.String... propertyNames)
Invokes the given function to retrieve the actual visual paddings and sets the client property. Also adds property change listener to component and re-invokes the function if one of the given properties have changed.
-
setVisualPadding
private static void setVisualPadding(javax.swing.JComponent c, java.awt.Insets visualPadding)
-
uninstall
public static void uninstall(javax.swing.JComponent c)
Removes listeners and restores client property.
-
-