Failsafe LAF Change

This might fix #312 I need to test it though
This commit is contained in:
Konloch 2021-07-04 21:09:10 -07:00
parent 52a3c2bfd0
commit 9f8c46bcdc

View file

@ -56,11 +56,31 @@ public enum LAFTheme
case DARK: case DARK:
LafManager.install(new DarculaTheme()); LafManager.install(new DarculaTheme());
failSafe();
break; break;
case LIGHT: case LIGHT:
LafManager.install(new IntelliJTheme()); LafManager.install(new IntelliJTheme());
failSafe();
break; break;
} }
} }
/**
* Attempts to failsafe by forcing an error before the mainviewer is called.
* It then defaults to the system theme
*/
private static void failSafe() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException
{
try
{
JInternalFrame test = new JInternalFrame("Test LAF");
test.dispose();
}
catch(Error e)
{
e.printStackTrace();
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
}
} }