diff --git a/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java b/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java index 19b5aafd..a41f9f29 100644 --- a/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java +++ b/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java @@ -71,14 +71,17 @@ public class DecorationsHandler { } public CustomTitlePane createTitlePane(final JRootPane rootPane, final int decorationStyle, final Window window) { + if (!decorationsProvider.isCustomDecorationSupported()) return DefaultDecorationsProvider.createNoOPTitlePane(); return decorationsProvider.createTitlePane(rootPane, decorationStyle, window); } public void installPopupWindow(final Window window) { + if (!decorationsProvider.isCustomDecorationSupported()) return; decorationsProvider.installPopupWindow(window); } public void uninstallPopupWindow(final Window window) { + if (!decorationsProvider.isCustomDecorationSupported()) return; decorationsProvider.uninstallPopupWindow(window); } diff --git a/core/src/main/java/com/github/weisj/darklaf/platform/DefaultDecorationsProvider.java b/core/src/main/java/com/github/weisj/darklaf/platform/DefaultDecorationsProvider.java index 67470d34..4784c4a3 100644 --- a/core/src/main/java/com/github/weisj/darklaf/platform/DefaultDecorationsProvider.java +++ b/core/src/main/java/com/github/weisj/darklaf/platform/DefaultDecorationsProvider.java @@ -32,6 +32,10 @@ import com.github.weisj.darklaf.platform.decorations.DecorationsProvider; public class DefaultDecorationsProvider implements DecorationsProvider { @Override public CustomTitlePane createTitlePane(final JRootPane rootPane, final int decorationStyle, final Window window) { + return createNoOPTitlePane(); + } + + static CustomTitlePane createNoOPTitlePane() { return new CustomTitlePane() { @Override public void uninstall(final boolean removeDecorations) {} diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java b/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java index 65032e61..c8a19b22 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java @@ -178,6 +178,8 @@ public class DarkPopupFactory extends PopupFactory { rootPane.putClientProperty("Window.shadow", !noDecorations); } if (noDecorations) { + // We also uninstall if decorations aren't enabled/supported as a reused window could be + // decorated previously. DecorationsHandler.getSharedInstance().uninstallPopupWindow(window); } else if (DecorationsHandler.getSharedInstance().isCustomDecorationSupported()) { DecorationsHandler.getSharedInstance().installPopupWindow(window);