diff --git a/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsPanel.java b/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsPanel.java index b2132dbe..d4ceee28 100644 --- a/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsPanel.java +++ b/core/src/main/java/com/github/weisj/darklaf/settings/ThemeSettingsPanel.java @@ -40,6 +40,7 @@ import com.github.weisj.darklaf.components.tooltip.ToolTipContext; import com.github.weisj.darklaf.components.tristate.TristateCheckBox; import com.github.weisj.darklaf.components.tristate.TristateState; import com.github.weisj.darklaf.graphics.ThemedColor; +import com.github.weisj.darklaf.listener.UIUpdater; import com.github.weisj.darklaf.platform.ThemePreferencesHandler; import com.github.weisj.darklaf.platform.macos.theme.MacOSColors; import com.github.weisj.darklaf.theme.Theme; @@ -491,11 +492,13 @@ public class ThemeSettingsPanel extends JPanel { int tickSpacing = 25; Dictionary dict = fontSlider.createStandardLabels(tickSpacing); JLabel min = ((JLabel) dict.get(fontSlider.getMinimum())); + UIUpdater.registerComponent(min); min.setText(resourceBundle.getString("label_font_smaller")); min.setAlignmentX(JComponent.LEFT_ALIGNMENT); min.putClientProperty(DarkSliderUI.KEY_MANUAL_LABEL_ALIGN, true); JLabel mid = ((JLabel) dict.get(fontSlider.getMinimum() + tickSpacing)); + UIUpdater.registerComponent(mid); dict.remove(fontSlider.getMinimum() + tickSpacing); dict.put(FontSizePreset.NORMAL.getPercentage(), mid); mid.setText(resourceBundle.getString("label_font_default")); @@ -507,6 +510,7 @@ public class ThemeSettingsPanel extends JPanel { max.setText(resourceBundle.getString("label_font_bigger")); max.setAlignmentX(JComponent.RIGHT_ALIGNMENT); max.putClientProperty(DarkSliderUI.KEY_MANUAL_LABEL_ALIGN, true); + UIUpdater.registerComponent(max); dict.remove(FontSizePreset.Small.getPercentage()); dict.remove(FontSizePreset.SMALL.getPercentage()); diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java index f94a327b..df95cada 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java @@ -156,11 +156,13 @@ public class DarkRootPaneUI extends BasicRootPaneUI implements HierarchyListener @Override protected void installListeners(final JRootPane root) { + root.addPropertyChangeListener(this); root.addHierarchyListener(this); } @Override protected void uninstallListeners(final JRootPane root) { + root.removePropertyChangeListener(this); root.removeHierarchyListener(this); } diff --git a/core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java b/core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java index f12479c8..ffa8dbcb 100644 --- a/core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java +++ b/core/src/main/java/com/github/weisj/darklaf/ui/slider/DarkSliderUI.java @@ -160,7 +160,15 @@ public class DarkSliderUI extends BasicSliderUI implements PropertyChangeListene @Override protected void calculateGeometry() { - super.calculateGeometry(); + // Thumb size should be calculated before content rect. + calculateFocusRect(); + calculateThumbSize(); + calculateContentRect(); + calculateTrackBuffer(); + calculateTrackRect(); + calculateTickRect(); + calculateLabelRect(); + calculateThumbLocation(); if (showVolumeIcon(slider)) { calculateIconRect(); } else { 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 0177e427..403fa8a2 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 @@ -82,6 +82,10 @@ public class MacOSTitlePane extends CustomTitlePane { inactiveBackground = UIManager.getColor("MacOS.TitlePane.inactiveBackground"); inactiveForeground = UIManager.getColor("MacOS.TitlePane.inactiveForeground"); border = UIManager.getColor("MacOS.TitlePane.borderColor"); + + // Ensure they don't get overwritten by ui updated. + activeForeground = new Color(activeForeground.getRGB()); + inactiveForeground = new Color(inactiveForeground.getRGB()); } @Override diff --git a/property-loader/src/main/java/com/github/weisj/darklaf/icons/ToggleIcon.java b/property-loader/src/main/java/com/github/weisj/darklaf/icons/ToggleIcon.java index 203a9459..ed48a84f 100644 --- a/property-loader/src/main/java/com/github/weisj/darklaf/icons/ToggleIcon.java +++ b/property-loader/src/main/java/com/github/weisj/darklaf/icons/ToggleIcon.java @@ -46,6 +46,10 @@ public class ToggleIcon implements Icon { 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); 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 7c3dc7fa..d0407fb1 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 @@ -316,6 +316,10 @@ public class WindowsTitlePane extends CustomTitlePane { inactiveHover = UIManager.getColor("Windows.TitlePane.inactiveBackgroundHover"); inactiveClick = UIManager.getColor("Windows.TitlePane.inactiveBackgroundClick"); border = UIManager.getColor("Windows.TitlePane.borderColor"); + + // Ensure they don't get overwritten by ui updated. + activeForeground = new Color(activeForeground.getRGB()); + inactiveForeground = new Color(inactiveForeground.getRGB()); } private void installDefaults() {