Skip to content

Commit

Permalink
InternalFrame: Hide shadow border if not inside a JDesktopPane
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed Aug 6, 2021
1 parent e48f23d commit 4537a68
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}

0 comments on commit 4537a68

Please sign in to comment.