Make theme changes also affect components that are not in UI tree.
This commit is contained in:
parent
fb4a15f0c3
commit
b52c194fd1
5 changed files with 37 additions and 11 deletions
|
@ -8,7 +8,8 @@ import com.github.weisj.darklaf.theme.IntelliJTheme;
|
||||||
import com.github.weisj.darklaf.theme.OneDarkTheme;
|
import com.github.weisj.darklaf.theme.OneDarkTheme;
|
||||||
import com.github.weisj.darklaf.theme.SolarizedDarkTheme;
|
import com.github.weisj.darklaf.theme.SolarizedDarkTheme;
|
||||||
import com.github.weisj.darklaf.theme.SolarizedLightTheme;
|
import com.github.weisj.darklaf.theme.SolarizedLightTheme;
|
||||||
import java.awt.Dialog;
|
|
||||||
|
import java.awt.*;
|
||||||
import javax.swing.JInternalFrame;
|
import javax.swing.JInternalFrame;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
@ -175,4 +176,14 @@ public enum LAFTheme
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.objectweb.asm.tree.InsnList;
|
||||||
import org.objectweb.asm.tree.LdcInsnNode;
|
import org.objectweb.asm.tree.LdcInsnNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
||||||
|
@ -53,6 +54,7 @@ public class LDCSearch implements SearchPanel
|
||||||
{
|
{
|
||||||
searchText = new JTextField("");
|
searchText = new JTextField("");
|
||||||
searchText.addKeyListener(EnterKeyEvent.SINGLETON);
|
searchText.addKeyListener(EnterKeyEvent.SINGLETON);
|
||||||
|
LAFTheme.registerThemeUpdate(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,6 +65,7 @@ public class LDCSearch implements SearchPanel
|
||||||
myPanel = new JPanel(new GridLayout(1, 2));
|
myPanel = new JPanel(new GridLayout(1, 2));
|
||||||
myPanel.add(new TranslatedJLabel("Search String: ", TranslatedComponents.SEARCH_STRING));
|
myPanel.add(new TranslatedJLabel("Search String: ", TranslatedComponents.SEARCH_STRING));
|
||||||
myPanel.add(searchText);
|
myPanel.add(searchText);
|
||||||
|
LAFTheme.registerThemeUpdate(myPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.objectweb.asm.Type;
|
||||||
import org.objectweb.asm.tree.AnnotationNode;
|
import org.objectweb.asm.tree.AnnotationNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
||||||
|
@ -46,6 +47,7 @@ public class MemberWithAnnotationSearch implements SearchPanel {
|
||||||
public MemberWithAnnotationSearch() {
|
public MemberWithAnnotationSearch() {
|
||||||
annotation = new JTextField("");
|
annotation = new JTextField("");
|
||||||
annotation.addKeyListener(EnterKeyEvent.SINGLETON);
|
annotation.addKeyListener(EnterKeyEvent.SINGLETON);
|
||||||
|
LAFTheme.registerThemeUpdate(annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -54,6 +56,7 @@ public class MemberWithAnnotationSearch implements SearchPanel {
|
||||||
myPanel = new JPanel(new GridLayout(1, 2));
|
myPanel = new JPanel(new GridLayout(1, 2));
|
||||||
myPanel.add(new TranslatedJLabel("Annotation name: ", TranslatedComponents.ANNOTATION_NAME));
|
myPanel.add(new TranslatedJLabel("Annotation name: ", TranslatedComponents.ANNOTATION_NAME));
|
||||||
myPanel.add(annotation);
|
myPanel.add(annotation);
|
||||||
|
LAFTheme.registerThemeUpdate(myPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
package the.bytecode.club.bytecodeviewer.searching.impl;
|
package the.bytecode.club.bytecodeviewer.searching.impl;
|
||||||
|
|
||||||
|
import com.github.weisj.darklaf.LafManager;
|
||||||
import eu.bibl.banalysis.asm.desc.OpcodeInfo;
|
import eu.bibl.banalysis.asm.desc.OpcodeInfo;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.*;
|
||||||
import javax.swing.JTextField;
|
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.InsnList;
|
import org.objectweb.asm.tree.InsnList;
|
||||||
import org.objectweb.asm.tree.MethodInsnNode;
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
||||||
|
@ -59,6 +61,8 @@ public class MethodCallSearch implements SearchPanel
|
||||||
mName.addKeyListener(EnterKeyEvent.SINGLETON);
|
mName.addKeyListener(EnterKeyEvent.SINGLETON);
|
||||||
mDesc = new JTextField("");
|
mDesc = new JTextField("");
|
||||||
mDesc.addKeyListener(EnterKeyEvent.SINGLETON);
|
mDesc.addKeyListener(EnterKeyEvent.SINGLETON);
|
||||||
|
|
||||||
|
LAFTheme.registerThemeUpdate(mOwner, mName, mDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JPanel getPanel()
|
public JPanel getPanel()
|
||||||
|
@ -72,6 +76,7 @@ public class MethodCallSearch implements SearchPanel
|
||||||
myPanel.add(mName);
|
myPanel.add(mName);
|
||||||
myPanel.add(new TranslatedJLabel("Desc: ", TranslatedComponents.DESC));
|
myPanel.add(new TranslatedJLabel("Desc: ", TranslatedComponents.DESC));
|
||||||
myPanel.add(mDesc);
|
myPanel.add(mDesc);
|
||||||
|
LAFTheme.registerThemeUpdate(myPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.objectweb.asm.Type;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
import the.bytecode.club.bytecodeviewer.searching.EnterKeyEvent;
|
||||||
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
import the.bytecode.club.bytecodeviewer.searching.LDCSearchTreeNodeResult;
|
||||||
|
@ -54,6 +55,8 @@ public class RegexSearch implements SearchPanel
|
||||||
{
|
{
|
||||||
searchText = new JTextField("");
|
searchText = new JTextField("");
|
||||||
searchText.addKeyListener(EnterKeyEvent.SINGLETON);
|
searchText.addKeyListener(EnterKeyEvent.SINGLETON);
|
||||||
|
|
||||||
|
LAFTheme.registerThemeUpdate(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,6 +67,7 @@ public class RegexSearch implements SearchPanel
|
||||||
myPanel = new JPanel(new GridLayout(1, 2));
|
myPanel = new JPanel(new GridLayout(1, 2));
|
||||||
myPanel.add(new TranslatedJLabel("Search Regex: ", TranslatedComponents.SEARCH_REGEX));
|
myPanel.add(new TranslatedJLabel("Search Regex: ", TranslatedComponents.SEARCH_REGEX));
|
||||||
myPanel.add(searchText);
|
myPanel.add(searchText);
|
||||||
|
LAFTheme.registerThemeUpdate(myPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
return myPanel;
|
return myPanel;
|
||||||
|
|
Loading…
Reference in a new issue