Browse Source

Remove darklaf.properties dependency from windows and mac module

jnf_util_static
Jannis Weis 3 years ago
parent
commit
fa442a8bd3
No known key found for this signature in database
GPG Key ID: 7C9D8D4B558049AB
  1. 9
      core/src/main/java/com/github/weisj/darklaf/nativelaf/DecorationsHandler.java
  2. 8
      core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java
  3. 3
      macos/build.gradle.kts
  4. 12
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java
  5. 6
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java
  6. 14
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java
  7. 5
      macos/src/main/module/module-info.java
  8. 9
      platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java
  9. 1
      windows/build.gradle.kts
  10. 20
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java
  11. 8
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsThemePreferenceProvider.java
  12. 14
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java
  13. 4
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/ScaledIcon.java
  14. 64
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/TitlebarIcon.java
  15. 20
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java
  16. 5
      windows/src/main/module/module-info.java

9
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.decorations.DecorationsProvider;
import com.github.weisj.darklaf.platform.macos.MacOSDecorationsProvider; import com.github.weisj.darklaf.platform.macos.MacOSDecorationsProvider;
import com.github.weisj.darklaf.platform.windows.WindowsDecorationsProvider; 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; import com.github.weisj.darklaf.util.PropertyUtil;
public class DecorationsHandler { public class DecorationsHandler {
@ -99,7 +101,12 @@ public class DecorationsHandler {
} }
public void loadDecorationProperties(final Properties uiProps, final UIDefaults defaults) { 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) { public void setDecorationsEnabled(final boolean enabled) {

8
core/src/main/java/com/github/weisj/darklaf/nativelaf/DefaultDecorationsProvider.java

@ -21,7 +21,8 @@
package com.github.weisj.darklaf.nativelaf; package com.github.weisj.darklaf.nativelaf;
import java.awt.*; import java.awt.*;
import java.util.Properties; import java.util.Collections;
import java.util.List;
import javax.swing.*; import javax.swing.*;
@ -53,5 +54,8 @@ public class DefaultDecorationsProvider implements DecorationsProvider {
public void initialize() {} public void initialize() {}
@Override @Override
public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) {} public List<String> getPropertyResourcePaths() {
return Collections.emptyList();
}
} }

3
macos/build.gradle.kts

@ -38,11 +38,10 @@ tasks.jar {
library { library {
dependencies { dependencies {
jvmImplementation(projects.darklafThemeSpec) jvmImplementation(projects.darklafThemeSpec)
jvmImplementation(projects.darklafNativeUtils)
jvmImplementation(projects.darklafUtils) jvmImplementation(projects.darklafUtils)
jvmImplementation(projects.darklafNativeUtils)
jvmImplementation(projects.darklafPlatformBase) jvmImplementation(projects.darklafPlatformBase)
jvmImplementation(projects.darklafPlatformDecorations) jvmImplementation(projects.darklafPlatformDecorations)
jvmImplementation(projects.darklafPropertyLoader)
nativeLibImplementation(macOsFrameworks.appKit) nativeLibImplementation(macOsFrameworks.appKit)
nativeLibImplementation(macOsFrameworks.cocoa) nativeLibImplementation(macOsFrameworks.cocoa)
nativeLibImplementation(macOsFrameworks.javaNativeFoundation) nativeLibImplementation(macOsFrameworks.javaNativeFoundation)

12
macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSDecorationsProvider.java

@ -21,7 +21,8 @@
package com.github.weisj.darklaf.platform.macos; package com.github.weisj.darklaf.platform.macos;
import java.awt.*; import java.awt.*;
import java.util.Properties; import java.util.Collections;
import java.util.List;
import javax.swing.*; 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.DecorationsProvider;
import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException; import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException;
import com.github.weisj.darklaf.platform.macos.ui.MacOSTitlePane; 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 { public class MacOSDecorationsProvider implements DecorationsProvider {
@ -58,10 +57,7 @@ public class MacOSDecorationsProvider implements DecorationsProvider {
} }
@Override @Override
public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { public List<String> getPropertyResourcePaths() {
IconLoader iconLoader = IconLoader.get(MacOSDecorationsProvider.class); return Collections.singletonList("macos_decorations");
PropertyLoader.putProperties(
PropertyLoader.loadProperties(MacOSDecorationsProvider.class, "macos_decorations", ""), properties,
currentDefaults, iconLoader);
} }
} }

6
macos/src/main/java/com/github/weisj/darklaf/platform/macos/MacOSPreferenceMonitor.java

@ -1,7 +1,7 @@
/* /*
* MIT License * 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 * 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, * 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.Objects;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.github.weisj.darklaf.util.LogUtil;
public class MacOSPreferenceMonitor { 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; private final MacOSThemePreferenceProvider preferenceProvider;

14
macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java

@ -1,7 +1,7 @@
/* /*
* MIT License * 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 * 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, * 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.decorations.CustomTitlePane;
import com.github.weisj.darklaf.platform.macos.JNIDecorationsMacOS; 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 { 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 JRootPane rootPane;
private final Window window; private final Window window;
@ -137,7 +134,7 @@ public class MacOSTitlePane extends CustomTitlePane {
} }
private boolean isUseColoredTitleBar(final JRootPane rootPane) { private boolean isUseColoredTitleBar(final JRootPane rootPane) {
return PropertyUtil.getBooleanProperty(rootPane, "JRootPane.coloredTitleBar", true); return MacOSDecorationsUtil.getBooleanProperty(rootPane, "JRootPane.coloredTitleBar", true);
} }
private String getTitle() { private String getTitle() {
@ -244,9 +241,8 @@ public class MacOSTitlePane extends CustomTitlePane {
|| getDecorationStyle() == JRootPane.NONE; || getDecorationStyle() == JRootPane.NONE;
} }
private void updateTitleBarVisibility() { private void updateTitleBarVisibility() {
titleBarHidden = PropertyUtil.getBooleanProperty(rootPane, "JRootPane.hideTitleBar"); titleBarHidden = MacOSDecorationsUtil.getBooleanProperty(rootPane, "JRootPane.hideTitleBar", false);
rootPane.doLayout(); rootPane.doLayout();
rootPane.repaint(); rootPane.repaint();
} }
@ -288,7 +284,7 @@ public class MacOSTitlePane extends CustomTitlePane {
@Override @Override
public void propertyChange(final PropertyChangeEvent pce) { public void propertyChange(final PropertyChangeEvent pce) {
String name = pce.getPropertyName(); String name = pce.getPropertyName();
if (PropertyKey.TITLE.equals(name)) { if ("title".equals(name)) {
titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString()); titleLabel.setText(pce.getNewValue() == null ? "" : pce.getNewValue().toString());
repaint(); repaint();
} }

5
macos/src/main/module/module-info.java

@ -25,11 +25,10 @@
open module darklaf.platform.macos { open module darklaf.platform.macos {
requires transitive darklaf.platform.decorations; requires transitive darklaf.platform.decorations;
requires transitive darklaf.theme.spec; requires transitive darklaf.theme.spec;
requires darklaf.platform.base;
requires darklaf.nativeutil; requires darklaf.platform.base;
requires darklaf.utils; 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 to darklaf.core, darklaf.platform.preferences;
exports com.github.weisj.darklaf.platform.macos.theme to darklaf.core, darklaf.platform.preferences; exports com.github.weisj.darklaf.platform.macos.theme to darklaf.core, darklaf.platform.preferences;

9
platform-decorations/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java

@ -21,7 +21,7 @@
package com.github.weisj.darklaf.platform.decorations; package com.github.weisj.darklaf.platform.decorations;
import java.awt.*; import java.awt.*;
import java.util.Properties; import java.util.List;
import javax.swing.*; import javax.swing.*;
@ -49,12 +49,11 @@ public interface DecorationsProvider {
void initialize(); 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. * @return path to load a resources from.
* @param currentDefaults the current ui defaults.
*/ */
void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults); List<String> getPropertyResourcePaths();
/** Initialize the window of a popup menu. */ /** Initialize the window of a popup menu. */
default void installPopupWindow(final Window window) {} default void installPopupWindow(final Window window) {}

1
windows/build.gradle.kts

@ -19,7 +19,6 @@ library {
jvmImplementation(projects.darklafPlatformBase) jvmImplementation(projects.darklafPlatformBase)
jvmImplementation(projects.darklafPlatformDecorations) jvmImplementation(projects.darklafPlatformDecorations)
jvmImplementation(projects.darklafThemeSpec) jvmImplementation(projects.darklafThemeSpec)
jvmImplementation(projects.darklafPropertyLoader)
} }
targetMachines.addAll(machines.windows.x86, machines.windows.x86_64) targetMachines.addAll(machines.windows.x86, machines.windows.x86_64)

20
windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java

@ -21,8 +21,8 @@
package com.github.weisj.darklaf.platform.windows; package com.github.weisj.darklaf.platform.windows;
import java.awt.*; import java.awt.*;
import java.util.Properties; import java.util.ArrayList;
import java.util.function.Consumer; import java.util.List;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; 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.DecorationsProvider;
import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException; import com.github.weisj.darklaf.platform.decorations.UnsupportedProviderException;
import com.github.weisj.darklaf.platform.windows.ui.WindowsTitlePane; 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 { public class WindowsDecorationsProvider implements DecorationsProvider {
@ -99,15 +97,13 @@ public class WindowsDecorationsProvider implements DecorationsProvider {
} }
@Override @Override
public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { public List<String> getPropertyResourcePaths() {
IconLoader iconLoader = IconLoader.get(WindowsDecorationsProvider.class); ArrayList<String> properties = new ArrayList<>();
Consumer<String> loadProps = fileName -> PropertyLoader.putProperties( properties.add("windows_icons");
PropertyLoader.loadProperties(WindowsDecorationsProvider.class, fileName, ""), properties.add("windows_decorations");
properties, currentDefaults, iconLoader);
loadProps.accept("windows_icons");
loadProps.accept("windows_decorations");
if (SystemInfo.isWindows11()) { if (SystemInfo.isWindows11()) {
loadProps.accept("windows_11_decorations"); properties.add("windows_11_decorations");
} }
return properties;
} }
} }

8
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.awt.*;
import java.util.function.Consumer; import java.util.function.Consumer;
import com.github.weisj.darklaf.properties.color.DarkColorModelHSB;
import com.github.weisj.darklaf.theme.spec.*; import com.github.weisj.darklaf.theme.spec.*;
public class WindowsThemePreferenceProvider implements ThemePreferenceProvider { public class WindowsThemePreferenceProvider implements ThemePreferenceProvider {
@ -56,8 +55,11 @@ public class WindowsThemePreferenceProvider implements ThemePreferenceProvider {
private Color deriveSelectionColor(final Color color) { private Color deriveSelectionColor(final Color color) {
if (color == null) return null; if (color == null) return null;
double[] hsb = DarkColorModelHSB.RGBtoHSBValues(color.getRed(), color.getGreen(), color.getBlue()); float[] hsb = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), null);
return DarkColorModelHSB.getColorFromHSBValues(hsb[0], hsb[1] / 2.5, Math.min(1, hsb[2] * 1.2)); 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) { private Color createColorFromRGB(final int rgb) {

14
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/MenuBarStealer.java

@ -1,7 +1,7 @@
/* /*
* MIT License * 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 * 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, * 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.JMenuBar;
import javax.swing.JRootPane; import javax.swing.JRootPane;
import com.github.weisj.darklaf.util.PropertyUtil;
public class MenuBarStealer { public class MenuBarStealer {
private final JRootPane rootPane; private final JRootPane rootPane;
@ -71,7 +69,7 @@ public class MenuBarStealer {
} }
public void updateMenuBar(final boolean install) { public void updateMenuBar(final boolean install) {
unifiedMenuBar = PropertyUtil.getBooleanProperty(rootPane, "JRootPane.unifiedMenuBar"); unifiedMenuBar = isUnifiedMenuBarEnabled(rootPane);
if (unifiedMenuBar && install) { if (unifiedMenuBar && install) {
if (rootPaneContainerListener == null) { if (rootPaneContainerListener == null) {
rootPaneContainerListener = createRootPaneContainerListener(); rootPaneContainerListener = createRootPaneContainerListener();
@ -92,6 +90,14 @@ public class MenuBarStealer {
rootPane.revalidate(); 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) { private void addMenuBar(final JMenuBar bar) {
if (bar != null && unifiedMenuBar) { if (bar != null && unifiedMenuBar) {
if (bar.getParent() != rootPane.getLayeredPane()) { if (bar.getParent() != rootPane.getLayeredPane()) {

4
property-loader/src/main/java/com/github/weisj/darklaf/properties/icons/ScaledIcon.java → windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/ScaledIcon.java

@ -1,7 +1,7 @@
/* /*
* MIT License * 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 * 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, * 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, * 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. * 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.*; import java.awt.*;

64
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();
}
}

20
windows/src/main/java/com/github/weisj/darklaf/platform/windows/ui/WindowsTitlePane.java

@ -1,7 +1,7 @@
/* /*
* MIT License * 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 * 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, * 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.decorations.CustomTitlePane;
import com.github.weisj.darklaf.platform.windows.JNIDecorationsWindows; import com.github.weisj.darklaf.platform.windows.JNIDecorationsWindows;
import com.github.weisj.darklaf.platform.windows.PointerUtil; 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.LogUtil;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil; import com.github.weisj.darklaf.util.PropertyUtil;
@ -69,10 +67,10 @@ public class WindowsTitlePane extends CustomTitlePane {
private PropertyChangeListener windowPropertyChangeListener; private PropertyChangeListener windowPropertyChangeListener;
private PropertyChangeListener rootPanePropertyChangeListener; private PropertyChangeListener rootPanePropertyChangeListener;
private WindowListener windowListener; private WindowListener windowListener;
private ToggleIcon closeIcon; private TitlebarIcon closeIcon;
private ToggleIcon maximizeIcon; private TitlebarIcon maximizeIcon;
private ToggleIcon restoreIcon; private TitlebarIcon restoreIcon;
private ToggleIcon minimizeIcon; private TitlebarIcon minimizeIcon;
private JButton windowIconButton; private JButton windowIconButton;
private JButton closeButton; private JButton closeButton;
private JButton maximizeToggleButton; private JButton maximizeToggleButton;
@ -379,13 +377,13 @@ public class WindowsTitlePane extends CustomTitlePane {
} }
private void createIcons() { 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")); 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")); 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")); 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")); UIManager.getIcon("Windows.TitlePane.closeInactive.icon"));
} }

5
windows/src/main/module/module-info.java

@ -25,11 +25,10 @@
open module darklaf.platform.windows { open module darklaf.platform.windows {
requires transitive darklaf.platform.decorations; requires transitive darklaf.platform.decorations;
requires transitive darklaf.theme.spec; requires transitive darklaf.theme.spec;
requires darklaf.platform.base;
requires darklaf.nativeutil; requires darklaf.platform.base;
requires darklaf.utils; requires darklaf.utils;
requires darklaf.properties; requires darklaf.nativeutil;
exports com.github.weisj.darklaf.platform.windows to darklaf.core, darklaf.platform.preferences; exports com.github.weisj.darklaf.platform.windows to darklaf.core, darklaf.platform.preferences;
} }

Loading…
Cancel
Save