From fa442a8bd308e409ff21f2f5e2ca2160bb9153f5 Mon Sep 17 00:00:00 2001 From: Jannis Weis <31143295+weisJ@users.noreply.github.com> Date: Tue, 1 Feb 2022 22:05:46 +0100 Subject: [PATCH] Remove darklaf.properties dependency from windows and mac module --- .../darklaf/nativelaf/DecorationsHandler.java | 9 ++- .../nativelaf/DefaultDecorationsProvider.java | 8 ++- macos/build.gradle.kts | 3 +- .../macos/MacOSDecorationsProvider.java | 12 ++-- .../macos/MacOSPreferenceMonitor.java | 6 +- .../platform/macos/ui/MacOSTitlePane.java | 14 ++-- macos/src/main/module/module-info.java | 5 +- .../decorations/DecorationsProvider.java | 9 ++- windows/build.gradle.kts | 1 - .../windows/WindowsDecorationsProvider.java | 20 +++--- .../WindowsThemePreferenceProvider.java | 8 ++- .../platform/windows/ui/MenuBarStealer.java | 14 ++-- .../platform/windows/ui}/ScaledIcon.java | 4 +- .../platform/windows/ui/TitlebarIcon.java | 64 +++++++++++++++++++ .../platform/windows/ui/WindowsTitlePane.java | 20 +++--- windows/src/main/module/module-info.java | 5 +- 16 files changed, 132 insertions(+), 70 deletions(-) rename {property-loader/src/main/java/com/github/weisj/darklaf/properties/icons => windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui}/ScaledIcon.java (95%) create mode 100644 windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/TitlebarIcon.java diff --git a/core/src/main/java/com/github/weisj/darklaf/nativelaf/DecorationsHandler.java b/core/src/main/java/com/github/weisj/darklaf/nativelaf/DecorationsHandler.java index d4cee7c9..6e8dc6fd 100644 --- a/core/src/main/java/com/github/weisj/darklaf/nativelaf/DecorationsHandler.java +++ b/core/src/main/java/com/github/weisj/darklaf/nativelaf/DecorationsHandler.java @@ -32,6 +32,8 @@ import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.decorations.DecorationsProvider; import com.github.weisj.darklaf.platform.macos.MacOSDecorationsProvider; import com.github.weisj.darklaf.platform.windows.WindowsDecorationsProvider; +import com.github.weisj.darklaf.properties.PropertyLoader; +import com.github.weisj.darklaf.properties.icons.IconLoader; import com.github.weisj.darklaf.util.PropertyUtil; public class DecorationsHandler { @@ -99,7 +101,12 @@ public class DecorationsHandler { } public void loadDecorationProperties(final Properties uiProps, final UIDefaults defaults) { - decorationsProvider.loadDecorationProperties(uiProps, defaults); + IconLoader iconLoader = IconLoader.get(decorationsProvider.getClass()); + for (String path : decorationsProvider.getPropertyResourcePaths()) { + PropertyLoader.putProperties( + PropertyLoader.loadProperties(decorationsProvider.getClass(), path, ""), + uiProps, defaults, iconLoader); + } } public void setDecorationsEnabled(final boolean enabled) { diff --git a/core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java b/core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java index 0f831dc7..b8466ff8 100644 --- a/core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java +++ b/core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java @@ -21,7 +21,8 @@ package com.github.weisj.darklaf.nativelaf; import java.awt.*; -import java.util.Properties; +import java.util.Collections; +import java.util.List; import javax.swing.*; @@ -53,5 +54,8 @@ public class DefaultDecorationsProvider implements DecorationsProvider { public void initialize() {} @Override - public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) {} + public List getPropertyResourcePaths() { + return Collections.emptyList(); + } + } diff --git a/macos/build.gradle.kts b/macos/build.gradle.kts index 5e268122..740cc8f3 100644 --- a/macos/build.gradle.kts +++ b/macos/build.gradle.kts @@ -38,11 +38,10 @@ tasks.jar { library { dependencies { jvmImplementation(projects.darklafThemeSpec) - jvmImplementation(projects.darklafNativeUtils) jvmImplementation(projects.darklafUtils) + jvmImplementation(projects.darklafNativeUtils) jvmImplementation(projects.darklafPlatformBase) jvmImplementation(projects.darklafPlatformDecorations) - jvmImplementation(projects.darklafPropertyLoader) nativeLibImplementation(macOsFrameworks.appKit) nativeLibImplementation(macOsFrameworks.cocoa) nativeLibImplementation(macOsFrameworks.javaNativeFoundation) diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java index b5bb1ef8..a4d35e1a 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java @@ -21,7 +21,8 @@ package com.github.weisj.darklaf.platform.macos; import java.awt.*; -import java.util.Properties; +import java.util.Collections; +import java.util.List; import javax.swing.*; @@ -30,8 +31,6 @@ import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.decorations.DecorationsProvider; import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException; import com.github.weisj.darklaf.platform.macos.ui.MacOSTitlePane; -import com.github.weisj.darklaf.properties.PropertyLoader; -import com.github.weisj.darklaf.properties.icons.IconLoader; public class MacOSDecorationsProvider implements DecorationsProvider { @@ -58,10 +57,7 @@ public class MacOSDecorationsProvider implements DecorationsProvider { } @Override - public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { - IconLoader iconLoader = IconLoader.get(MacOSDecorationsProvider.class); - PropertyLoader.putProperties( - PropertyLoader.loadProperties(MacOSDecorationsProvider.class, "macos_decorations", ""), properties, - currentDefaults, iconLoader); + public List getPropertyResourcePaths() { + return Collections.singletonList("macos_decorations"); } } diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java index dc9e0bed..30542684 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2020-2021 Jannis Weis + * Copyright (c) 2020-2022 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -24,11 +24,9 @@ import java.awt.*; import java.util.Objects; import java.util.logging.Logger; -import com.github.weisj.darklaf.util.LogUtil; - public class MacOSPreferenceMonitor { - private static final Logger LOGGER = LogUtil.getLogger(MacOSThemePreferenceProvider.class); + private static final Logger LOGGER = Logger.getLogger(MacOSThemePreferenceProvider.class.getName()); private final MacOSThemePreferenceProvider preferenceProvider; diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java index 23cfc53a..232738de 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2020-2021 Jannis Weis + * Copyright (c) 2020-2022 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -32,13 +32,10 @@ import javax.swing.*; import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.macos.JNIDecorationsMacOS; -import com.github.weisj.darklaf.util.LogUtil; -import com.github.weisj.darklaf.util.PropertyKey; -import com.github.weisj.darklaf.util.PropertyUtil; public class MacOSTitlePane extends CustomTitlePane { - private static final Logger LOGGER = LogUtil.getLogger(MacOSTitlePane.class); + private static final Logger LOGGER = Logger.getLogger(MacOSTitlePane.class.getName()); private final JRootPane rootPane; private final Window window; @@ -137,7 +134,7 @@ public class MacOSTitlePane extends CustomTitlePane { } private boolean isUseColoredTitleBar(final JRootPane rootPane) { - return PropertyUtil.getBooleanProperty(rootPane, "JRootPane.coloredTitleBar", true); + return MacOSDecorationsUtil.getBooleanProperty(rootPane, "JRootPane.coloredTitleBar", true); } private String getTitle() { @@ -244,9 +241,8 @@ public class MacOSTitlePane extends CustomTitlePane { || getDecorationStyle() == JRootPane.NONE; } - private void updateTitleBarVisibility() { - titleBarHidden = PropertyUtil.getBooleanProperty(rootPane, "JRootPane.hideTitleBar"); + titleBarHidden = MacOSDecorationsUtil.getBooleanProperty(rootPane, "JRootPane.hideTitleBar", false); rootPane.doLayout(); rootPane.repaint(); } @@ -288,7 +284,7 @@ public class MacOSTitlePane extends CustomTitlePane { @Override public void propertyChange(final PropertyChangeEvent pce) { String name = pce.getPropertyName(); - if (PropertyKey.TITLE.equals(name)) { + if ("title".equals(name)) { titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString()); repaint(); } diff --git a/macos/src/main/module/module-info.java b/macos/src/main/module/module-info.java index ea807234..7b3c7ce9 100644 --- a/macos/src/main/module/module-info.java +++ b/macos/src/main/module/module-info.java @@ -25,11 +25,10 @@ open module darklaf.platform.macos { requires transitive darklaf.platform.decorations; requires transitive darklaf.theme.spec; - requires darklaf.platform.base; - requires darklaf.nativeutil; + requires darklaf.platform.base; requires darklaf.utils; - requires darklaf.properties; + requires darklaf.nativeutil; exports com.github.weisj.darklaf.platform.macos to darklaf.core, darklaf.platform.preferences; exports com.github.weisj.darklaf.platform.macos.theme to darklaf.core, darklaf.platform.preferences; diff --git a/platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java b/platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java index 35c8df93..3d1c67ad 100644 --- a/platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java +++ b/platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java @@ -21,7 +21,7 @@ package com.github.weisj.darklaf.platform.decorations; import java.awt.*; -import java.util.Properties; +import java.util.List; import javax.swing.*; @@ -49,12 +49,11 @@ public interface DecorationsProvider { void initialize(); /** - * Load the necessary properties into the defaults. + * Returns the path to the decoration properties. * - * @param properties the properties to load the values into. - * @param currentDefaults the current ui defaults. + * @return path to load a resources from. */ - void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults); + List getPropertyResourcePaths(); /** Initialize the window of a popup menu. */ default void installPopupWindow(final Window window) {} diff --git a/windows/build.gradle.kts b/windows/build.gradle.kts index 0febffd4..8b6e6d6f 100644 --- a/windows/build.gradle.kts +++ b/windows/build.gradle.kts @@ -19,7 +19,6 @@ library { jvmImplementation(projects.darklafPlatformBase) jvmImplementation(projects.darklafPlatformDecorations) jvmImplementation(projects.darklafThemeSpec) - jvmImplementation(projects.darklafPropertyLoader) } targetMachines.addAll(machines.windows.x86, machines.windows.x86_64) diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java index 71b370c8..e5f7d4a3 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java @@ -21,8 +21,8 @@ package com.github.weisj.darklaf.platform.windows; import java.awt.*; -import java.util.Properties; -import java.util.function.Consumer; +import java.util.ArrayList; +import java.util.List; import javax.swing.*; import javax.swing.border.Border; @@ -32,8 +32,6 @@ import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.decorations.DecorationsProvider; import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException; import com.github.weisj.darklaf.platform.windows.ui.WindowsTitlePane; -import com.github.weisj.darklaf.properties.PropertyLoader; -import com.github.weisj.darklaf.properties.icons.IconLoader; public class WindowsDecorationsProvider implements DecorationsProvider { @@ -99,15 +97,13 @@ public class WindowsDecorationsProvider implements DecorationsProvider { } @Override - public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { - IconLoader iconLoader = IconLoader.get(WindowsDecorationsProvider.class); - Consumer loadProps = fileName -> PropertyLoader.putProperties( - PropertyLoader.loadProperties(WindowsDecorationsProvider.class, fileName, ""), - properties, currentDefaults, iconLoader); - loadProps.accept("windows_icons"); - loadProps.accept("windows_decorations"); + public List getPropertyResourcePaths() { + ArrayList properties = new ArrayList<>(); + properties.add("windows_icons"); + properties.add("windows_decorations"); if (SystemInfo.isWindows11()) { - loadProps.accept("windows_11_decorations"); + properties.add("windows_11_decorations"); } + return properties; } } diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsThemePreferenceProvider.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsThemePreferenceProvider.java index 08c197b5..a80c6afa 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsThemePreferenceProvider.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsThemePreferenceProvider.java @@ -23,7 +23,6 @@ package com.github.weisj.darklaf.platform.windows; import java.awt.*; import java.util.function.Consumer; -import com.github.weisj.darklaf.properties.color.DarkColorModelHSB; import com.github.weisj.darklaf.theme.spec.*; public class WindowsThemePreferenceProvider implements ThemePreferenceProvider { @@ -56,8 +55,11 @@ public class WindowsThemePreferenceProvider implements ThemePreferenceProvider { private Color deriveSelectionColor(final Color color) { if (color == null) return null; - double[] hsb = DarkColorModelHSB.RGBtoHSBValues(color.getRed(), color.getGreen(), color.getBlue()); - return DarkColorModelHSB.getColorFromHSBValues(hsb[0], hsb[1] / 2.5, Math.min(1, hsb[2] * 1.2)); + float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null); + float h = hsb[0]; + float s = hsb[1] / 2.5f; + float b = Math.min(1, hsb[2] * 1.2f); + return Color.getHSBColor(Math.max(Math.min(h, 1), 0), Math.max(Math.min(s, 1), 0), Math.max(Math.min(b, 1), 0)); } private Color createColorFromRGB(final int rgb) { diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java index 1201ad1d..a887eb24 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2021 Jannis Weis + * Copyright (c) 2021-2022 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -30,8 +30,6 @@ import javax.swing.JLayeredPane; import javax.swing.JMenuBar; import javax.swing.JRootPane; -import com.github.weisj.darklaf.util.PropertyUtil; - public class MenuBarStealer { private final JRootPane rootPane; @@ -71,7 +69,7 @@ public class MenuBarStealer { } public void updateMenuBar(final boolean install) { - unifiedMenuBar = PropertyUtil.getBooleanProperty(rootPane, "JRootPane.unifiedMenuBar"); + unifiedMenuBar = isUnifiedMenuBarEnabled(rootPane); if (unifiedMenuBar && install) { if (rootPaneContainerListener == null) { rootPaneContainerListener = createRootPaneContainerListener(); @@ -92,6 +90,14 @@ public class MenuBarStealer { rootPane.revalidate(); } + private boolean isUnifiedMenuBarEnabled(final JComponent c) { + Object obj = c.getClientProperty("JRootPane.unifiedMenuBar"); + if (!(obj instanceof Boolean) && obj != null) { + obj = Boolean.parseBoolean(obj.toString()); + } + return Boolean.TRUE.equals(obj); + } + private void addMenuBar(final JMenuBar bar) { if (bar != null && unifiedMenuBar) { if (bar.getParent() != rootPane.getLayeredPane()) { diff --git a/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/ScaledIcon.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/ScaledIcon.java similarity index 95% rename from property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/ScaledIcon.java rename to windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/ScaledIcon.java index b2111243..d5bf5e38 100644 --- a/property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/ScaledIcon.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/ScaledIcon.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2019-2021 Jannis Weis + * Copyright (c) 2022 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -18,7 +18,7 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -package com.github.weisj.darklaf.properties.icons; +package com.github.weisj.darklaf.platform.windows.ui; import java.awt.*; diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/TitlebarIcon.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/TitlebarIcon.java new file mode 100644 index 00000000..f9345ac4 --- /dev/null +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/TitlebarIcon.java @@ -0,0 +1,64 @@ +/* + * MIT License + * + * Copyright (c) 2022 Jannis Weis + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT + * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.github.weisj.darklaf.platform.windows.ui; + +import java.awt.*; + +import javax.swing.*; + +public class TitlebarIcon implements Icon { + + private final Icon activeIcon; + private final Icon inactiveIcon; + private boolean active = true; + + public TitlebarIcon(final Icon active, final Icon inactive) { + this.activeIcon = active; + this.inactiveIcon = inactive; + } + + public void setActive(final boolean active) { + this.active = active; + } + + public boolean isActive() { + return active; + } + + @Override + public void paintIcon(final Component c, final Graphics g, final int x, final int y) { + currentIcon().paintIcon(c, g, x, y); + } + + private Icon currentIcon() { + return active ? activeIcon : inactiveIcon; + } + + @Override + public int getIconWidth() { + return currentIcon().getIconWidth(); + } + + @Override + public int getIconHeight() { + return currentIcon().getIconHeight(); + } +} diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java index 07e3185b..c3eb1f31 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2019-2021 Jannis Weis + * Copyright (c) 2019-2022 Jannis Weis * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, @@ -36,8 +36,6 @@ import javax.swing.plaf.UIResource; import com.github.weisj.darklaf.platform.decorations.CustomTitlePane; import com.github.weisj.darklaf.platform.windows.JNIDecorationsWindows; import com.github.weisj.darklaf.platform.windows.PointerUtil; -import com.github.weisj.darklaf.properties.icons.ScaledIcon; -import com.github.weisj.darklaf.properties.icons.ToggleIcon; import com.github.weisj.darklaf.util.LogUtil; import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyUtil; @@ -69,10 +67,10 @@ public class WindowsTitlePane extends CustomTitlePane { private PropertyChangeListener windowPropertyChangeListener; private PropertyChangeListener rootPanePropertyChangeListener; private WindowListener windowListener; - private ToggleIcon closeIcon; - private ToggleIcon maximizeIcon; - private ToggleIcon restoreIcon; - private ToggleIcon minimizeIcon; + private TitlebarIcon closeIcon; + private TitlebarIcon maximizeIcon; + private TitlebarIcon restoreIcon; + private TitlebarIcon minimizeIcon; private JButton windowIconButton; private JButton closeButton; private JButton maximizeToggleButton; @@ -379,13 +377,13 @@ public class WindowsTitlePane extends CustomTitlePane { } private void createIcons() { - minimizeIcon = new ToggleIcon(UIManager.getIcon("Windows.TitlePane.minimize.icon"), + minimizeIcon = new TitlebarIcon(UIManager.getIcon("Windows.TitlePane.minimize.icon"), UIManager.getIcon("Windows.TitlePane.minimizeInactive.icon")); - maximizeIcon = new ToggleIcon(UIManager.getIcon("Windows.TitlePane.maximize.icon"), + maximizeIcon = new TitlebarIcon(UIManager.getIcon("Windows.TitlePane.maximize.icon"), UIManager.getIcon("Windows.TitlePane.maximizeInactive.icon")); - restoreIcon = new ToggleIcon(UIManager.getIcon("Windows.TitlePane.restore.icon"), + restoreIcon = new TitlebarIcon(UIManager.getIcon("Windows.TitlePane.restore.icon"), UIManager.getIcon("Windows.TitlePane.restoreInactive.icon")); - closeIcon = new ToggleIcon(UIManager.getIcon("Windows.TitlePane.close.icon"), + closeIcon = new TitlebarIcon(UIManager.getIcon("Windows.TitlePane.close.icon"), UIManager.getIcon("Windows.TitlePane.closeInactive.icon")); } diff --git a/windows/src/main/module/module-info.java b/windows/src/main/module/module-info.java index 7c3bfb24..b982aced 100644 --- a/windows/src/main/module/module-info.java +++ b/windows/src/main/module/module-info.java @@ -25,11 +25,10 @@ open module darklaf.platform.windows { requires transitive darklaf.platform.decorations; requires transitive darklaf.theme.spec; - requires darklaf.platform.base; - requires darklaf.nativeutil; + requires darklaf.platform.base; requires darklaf.utils; - requires darklaf.properties; + requires darklaf.nativeutil; exports com.github.weisj.darklaf.platform.windows to darklaf.core, darklaf.platform.preferences; }