Search in sources :

Example 1 with ExperienceBlue

use of com.jgoodies.looks.plastic.theme.ExperienceBlue in project qi4j-sdk by Qi4j.

the class Envisage method initLookAndFeel.

private void initLookAndFeel() {
    String osName = System.getProperty("os.name").toUpperCase();
    // set to use swing anti alias text only for JVM <= 1.5
    System.setProperty("swing.aatext", "true");
    // set default swing bold to false, only for JVM 1.5 or above
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    // set LaF
    LookAndFeel lnf = UIManager.getLookAndFeel();
    if (lnf != null && lnf.getID().equalsIgnoreCase("Metal")) {
        final String lnfClassName;
        if (osName.startsWith("MAC")) {
            //TODO i18n
            System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Envisage");
            System.setProperty("apple.laf.useScreenMenuBar", "true");
            lnfClassName = UIManager.getSystemLookAndFeelClassName();
        } else if (osName.startsWith("WINDOWS")) {
            UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
            lnfClassName = Options.getSystemLookAndFeelClassName();
            Options.setUseNarrowButtons(false);
        } else {
            UIManager.put("ClassLoader", LookUtils.class.getClassLoader());
            lnfClassName = Options.getCrossPlatformLookAndFeelClassName();
            PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_METAL_VALUE);
            PlasticLookAndFeel.setPlasticTheme(new ExperienceBlue());
            Options.setUseNarrowButtons(false);
        //PlasticLookAndFeel.setMyCurrentTheme(new ExperienceBlueDefaultFont());  // for CJK Font
        }
        if (lnfClassName != null) {
            try {
                UIManager.setLookAndFeel(lnfClassName);
            } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | UnsupportedLookAndFeelException ex) {
                System.err.println("Unable to set LookAndFeel, use default LookAndFeel.\n" + ex.getMessage());
            }
        }
    }
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) ExperienceBlue(com.jgoodies.looks.plastic.theme.ExperienceBlue) PlasticLookAndFeel(com.jgoodies.looks.plastic.PlasticLookAndFeel) LookAndFeel(javax.swing.LookAndFeel)

Aggregations

PlasticLookAndFeel (com.jgoodies.looks.plastic.PlasticLookAndFeel)1 ExperienceBlue (com.jgoodies.looks.plastic.theme.ExperienceBlue)1 LookAndFeel (javax.swing.LookAndFeel)1 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)1