mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-08-17 22:58:12 +08:00
Update theming code to clear UIDefaults values; undo test call to change
the Look and Feel
This commit is contained in:
@@ -1092,28 +1092,7 @@ public class AbstractGuiTest extends AbstractGenericTest {
|
||||
* running <code>doRun</code>
|
||||
*/
|
||||
public static void fixupGUI() throws InterruptedException, InvocationTargetException {
|
||||
// Make the test look & feel as it would normally.
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
try {
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (ClassNotFoundException e1) {
|
||||
// don't care
|
||||
}
|
||||
catch (InstantiationException e2) {
|
||||
// don't care
|
||||
}
|
||||
catch (IllegalAccessException e3) {
|
||||
// don't care
|
||||
}
|
||||
catch (UnsupportedLookAndFeelException e4) {
|
||||
// don't care
|
||||
}
|
||||
});
|
||||
// Fix up the default fonts that Java 1.5.0 changed to Courier, which looked terrible.
|
||||
Font f = new Font("monospaced", Font.PLAIN, 12);
|
||||
UIManager.put("PasswordField.font", f);
|
||||
UIManager.put("TextArea.font", f);
|
||||
// here to prevent compiler errors; should not be needed now that we have theming
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,6 +70,7 @@ public abstract class LookAndFeelManager {
|
||||
public void installLookAndFeel() throws ClassNotFoundException, InstantiationException,
|
||||
IllegalAccessException, UnsupportedLookAndFeelException {
|
||||
|
||||
clearUiDefaults();
|
||||
doInstallLookAndFeel();
|
||||
processJavaDefaults();
|
||||
fixupLookAndFeelIssues();
|
||||
@@ -77,6 +78,16 @@ public abstract class LookAndFeelManager {
|
||||
updateComponentUis();
|
||||
}
|
||||
|
||||
protected void clearUiDefaults() {
|
||||
/*
|
||||
The UIDefaults extends hash table. It has 2 layers into which it puts values: the base
|
||||
hash table and the set of tables created by the Look and Feel. When the LaF changes,
|
||||
any values it puts in will get replaced. Any values we put in will be in the non-Laf
|
||||
layer. Thus, to remove our old values, we need to clear the main hash table.
|
||||
*/
|
||||
UIManager.getDefaults().clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when all colors, fonts, and icons may have changed
|
||||
* @param javaDefaults the current set of java defaults so that those ids can be updated
|
||||
|
||||
Reference in New Issue
Block a user