Search in sources :

Example 1 with SubstanceSkin

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);
    }
}
Also used : LookAndFeel(javax.swing.LookAndFeel) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) SubstanceLookAndFeel(org.pushingpixels.substance.api.SubstanceLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) SubstanceSkin(org.pushingpixels.substance.api.SubstanceSkin) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) Preferences(java.util.prefs.Preferences)

Aggregations

Preferences (java.util.prefs.Preferences)1 LookAndFeel (javax.swing.LookAndFeel)1 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)1 MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)1 NimbusLookAndFeel (javax.swing.plaf.nimbus.NimbusLookAndFeel)1 SubstanceLookAndFeel (org.pushingpixels.substance.api.SubstanceLookAndFeel)1 SubstanceSkin (org.pushingpixels.substance.api.SubstanceSkin)1