Class MigLayoutVisualPadding


  • public class MigLayoutVisualPadding
    extends 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.
    • Field Detail

      • VISUAL_PADDING_PROPERTY

        public static 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.
    • Constructor Detail

      • MigLayoutVisualPadding

        public MigLayoutVisualPadding()
    • Method Detail

      • install

        public static void install​(JComponent c,
                                   Insets insets)
        Sets the client property to the given insets.
      • install

        public static void install​(JComponent c)
        Convenience method that checks whether component border is a FlatBorder.
      • install

        public static void install​(JComponent c,
                                   Function<JComponent,​Insets> getPaddingFunction,
                                   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.
      • uninstall

        public static void uninstall​(JComponent c)
        Removes listeners and restores client property.