From 7c8edb3179a9fade86ecd1f9215b2ba811f2fad0 Mon Sep 17 00:00:00 2001 From: GraxCode Date: Mon, 18 Apr 2022 11:18:19 +0200 Subject: [PATCH] Implement suggestion by @weisJ --- .../club/bytecodeviewer/gui/theme/LAFTheme.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java index b8d24c36..ec7418b5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/theme/LAFTheme.java @@ -1,6 +1,7 @@ package the.bytecode.club.bytecodeviewer.gui.theme; import com.github.weisj.darklaf.LafManager; +import com.github.weisj.darklaf.listener.UIUpdater; import com.github.weisj.darklaf.theme.DarculaTheme; import com.github.weisj.darklaf.theme.HighContrastDarkTheme; import com.github.weisj.darklaf.theme.HighContrastLightTheme; @@ -10,10 +11,8 @@ import com.github.weisj.darklaf.theme.SolarizedDarkTheme; import com.github.weisj.darklaf.theme.SolarizedLightTheme; import java.awt.*; -import javax.swing.JInternalFrame; -import javax.swing.SwingUtilities; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.*; + import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.gui.components.SettingsDialog; @@ -180,10 +179,9 @@ public enum LAFTheme /** * Make sure that theme changes also affect components that are not in the UI tree. */ - public static void registerThemeUpdate(Component... components) { - LafManager.registerInitTask((t, p) -> SwingUtilities.invokeLater(() -> { - for (Component component : components) - SwingUtilities.updateComponentTreeUI(component); - })); + public static void registerThemeUpdate(JComponent... components) { + for (JComponent comp : components) { + UIUpdater.registerComponent(comp); + } } }