use of org.pushingpixels.substance.api.SubstanceSkin in project jgnash by ccavanaugh.
the class ThemeManager method setLookAndFeel.
private static void setLookAndFeel(final String lookAndFeel) {
Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
String theme = pref.get(THEME, DEFAULT_THEME);
try {
Class<?> lafClass = Class.forName(lookAndFeel);
Object lafInstance = lafClass.newInstance();
if (lafInstance instanceof SubstanceSkin) {
UIManager.put(SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS, Boolean.TRUE);
if (isSubstanceAnimationsEnabled()) {
AnimationConfigurationManager.getInstance().setTimelineDuration(animationDuration);
} else {
AnimationConfigurationManager.getInstance().setTimelineDuration(0);
}
SubstanceLookAndFeel.setSkin(lookAndFeel);
} else if (lafInstance instanceof NimbusLookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
NimbusUtils.changeFontSize(getNimbusFontSize());
} else if (lafInstance instanceof MetalLookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
setTheme(theme);
} else if (lafInstance instanceof LookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
}
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e);
}
}
Aggregations