@ -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) {
decorationsProvider.uninstallPopupWindow(window);
@ -32,6 +32,10 @@ import com.github.weisj.darklaf.platform.decorations.DecorationsProvider;
public class DefaultDecorationsProvider implements DecorationsProvider {
@Override
return createNoOPTitlePane();
static CustomTitlePane createNoOPTitlePane() {
return new CustomTitlePane() {
public void uninstall(final boolean removeDecorations) {}
@ -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);