Code Cleanup

This commit is contained in:
Konloch 2021-07-19 03:56:52 -07:00
parent 69b282aa2d
commit 244ed68599
2 changed files with 12 additions and 13 deletions

View File

@ -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<JCheckBoxMenuItem> options = new ArrayList<>();
public static final List<SettingsDialogue> dialogues = new ArrayList<>();
private final List<JMenuItem> options = new ArrayList<>();
private final JMenu menu;
private final JPanel display;
public SettingsDialogue(JMenu menu, JPanel display)
{
super(display);
List<JCheckBoxMenuItem> options = new ArrayList<>();
List<JMenuItem> 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);
}

View File

@ -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);
}
}