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:
LafManager.install(new DarculaTheme());
failSafe();
break;
case LIGHT:
LafManager.install(new IntelliJTheme());
failSafe();
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());
}
}
}