From 4537a687f8a5f669076da8189c4a133a2842db02 Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Fri, 6 Aug 2021 14:42:55 +0200 Subject: [PATCH] InternalFrame: Hide shadow border if not inside a JDesktopPane --- .../ui/internalframe/DarkInternalFrameBorder.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameBorder.java b/core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameBorder.java index 4777669a1..6f0089b3c 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameBorder.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/internalframe/DarkInternalFrameBorder.java @@ -52,7 +52,7 @@ public DarkInternalFrameBorder() { @Override public void paintBorder(final Component c, final Graphics graphics, final int x, final int y, final int width, final int height) { - if (c instanceof JInternalFrame && ((JInternalFrame) c).isMaximum()) { + if (shouldHideShadow(c)) { return; } updateOpacity(c); @@ -69,10 +69,17 @@ protected void updateOpacity(final Component c) { @Override public Insets getBorderInsets(final Component c) { - if (c instanceof JInternalFrame && ((JInternalFrame) c).isMaximum()) { + if (shouldHideShadow(c)) { return new InsetsUIResource(0, 0, 0, 0); } updateOpacity(c); return super.getBorderInsets(c); } + + private boolean shouldHideShadow(final Component c) { + if (!(c instanceof JInternalFrame) || ((JInternalFrame) c).isMaximum()) { + return true; + } + return !(c.getParent() instanceof JDesktopPane); + } }