diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/VisualPaddingProvider.java b/core/src/main/java/com/github/weisj/darklaf/ui/VisualPaddingProvider.java index e6ace401..4acc18da 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/VisualPaddingProvider.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/VisualPaddingProvider.java @@ -27,6 +27,7 @@ import javax.swing.*; import javax.swing.border.Border; import javax.swing.plaf.InsetsUIResource; +import com.github.weisj.darklaf.util.DarkUIUtil; import com.github.weisj.darklaf.util.PropertyUtil; public interface VisualPaddingProvider { @@ -36,7 +37,7 @@ public interface VisualPaddingProvider { Insets getVisualPaddings(Component component); static void updateProperty(final JComponent c) { - Border b = c.getBorder(); + Border b = DarkUIUtil.getUnwrappedBorder(c); if (b instanceof VisualPaddingProvider) { Insets ins = ((VisualPaddingProvider) b).getVisualPaddings(c); PropertyUtil.installProperty(c, VISUAL_PADDING_PROP, diff --git a/core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java b/core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java index bea591b0..3d621bfb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java +++ b/core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java @@ -35,6 +35,7 @@ import java.util.function.Predicate; import javax.swing.*; import javax.swing.border.Border; +import javax.swing.border.CompoundBorder; import javax.swing.plaf.ComponentUI; import javax.swing.plaf.InsetsUIResource; import javax.swing.table.TableCellEditor; @@ -60,6 +61,14 @@ public final class DarkUIUtil { private static final Rectangle iconRect = new Rectangle(); private static final Rectangle textRect = new Rectangle(); + public static Border getUnwrappedBorder(final JComponent c) { + Border b = c.getBorder(); + while (b instanceof CompoundBorder) { + b = ((CompoundBorder) b).getOutsideBorder(); + } + return b; + } + public static Rectangle applyInsets(final Rectangle rect, final Insets insets) { if (insets != null && rect != null) { rect.x += insets.left;