diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SettingsDialogue.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SettingsDialogue.java index 65c9aad3..c914e8d7 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SettingsDialogue.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SettingsDialogue.java @@ -1,7 +1,5 @@ package the.bytecode.club.bytecodeviewer.gui.components; -import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI; - import javax.swing.*; import java.awt.*; import java.util.ArrayList; @@ -32,31 +30,36 @@ import java.util.List; public class SettingsDialogue extends JScrollPane { - private final List options = new ArrayList<>(); + public static final List dialogues = new ArrayList<>(); + private final List options = new ArrayList<>(); private final JMenu menu; private final JPanel display; public SettingsDialogue(JMenu menu, JPanel display) { super(display); - List options = new ArrayList<>(); + List options = new ArrayList<>(); for(Component child : menu.getMenuComponents()) { - if(!(child instanceof JCheckBoxMenuItem)) + if(!(child instanceof JMenuItem)) continue; - options.add((JCheckBoxMenuItem) child); + options.add((JMenuItem) child); } + this.menu = menu; this.options.addAll(options); this.display = display; + buildPanel(); + + dialogues.add(this); } private void buildPanel() { display.setLayout(new BoxLayout(display, BoxLayout.Y_AXIS)); - for(JCheckBoxMenuItem menuItem : options) + for(JMenuItem menuItem : options) display.add(menuItem); } 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 de5f9a7b..5c84bc4c 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 @@ -4,12 +4,11 @@ import com.github.weisj.darklaf.LafManager; import com.github.weisj.darklaf.theme.*; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; +import the.bytecode.club.bytecodeviewer.gui.components.SettingsDialogue; import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent; import the.bytecode.club.bytecodeviewer.translation.Translation; import javax.swing.*; -import java.util.Map; -import java.util.Set; /** * @author Konloch @@ -104,10 +103,7 @@ public enum LAFTheme if(BytecodeViewer.viewer != null) { BytecodeViewer.viewer.uiComponents.forEach(VisibleComponent::setDefaultIcon); - SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.procyonSettingsDialogue); - SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.cfrSettingsDialogue); - SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.fernFlowerSettingsDialogue); - SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.bytecodeDecompilerSettingsDialogue); + SettingsDialogue.dialogues.forEach(SwingUtilities::updateComponentTreeUI); } }