Example usage for com.jgoodies.looks Options USE_SYSTEM_FONTS_APP_KEY

List of usage examples for com.jgoodies.looks Options USE_SYSTEM_FONTS_APP_KEY

Introduction

In this page you can find the example usage for com.jgoodies.looks Options USE_SYSTEM_FONTS_APP_KEY.

Prototype

String USE_SYSTEM_FONTS_APP_KEY

To view the source code for com.jgoodies.looks Options USE_SYSTEM_FONTS_APP_KEY.

Click Source Link

Document

A convenience constant for the standard Swing UIDefaults key that configures the use of system fonts.

Usage

From source file:com.jtstand.swing.MainFrame.java

License:Open Source License

public static void setLookAndFeel() {
    try {//from   ww  w.jav a2  s  .  co m
        //            String crosslaf = UIManager.getCrossPlatformLookAndFeelClassName();
        //            System.out.println("Cross Platfowm Look & Feel:" + crosslaf);

        String systemlaf = UIManager.getSystemLookAndFeelClassName();
        //            System.out.println("System Look & Feel:" + systemlaf);

        String nimbus = null;
        String windows = null;
        LookAndFeelInfo[] lafis = UIManager.getInstalledLookAndFeels();
        log.info("Installed Look & Feels:");
        for (int i = 0; i < lafis.length; i++) {
            LookAndFeelInfo lafi = lafis[i];
            String name = lafi.getName();
            log.info("[" + i + "]=" + name);
            if ("Nimbus".equals(name)) {
                nimbus = lafi.getClassName();
            } else if ("Windows".equals(name)) {
                windows = lafi.getClassName();
            }
        }

        //            if (windows != null) {
        //                UIManager.setLookAndFeel(windows);
        //                return;
        //            }
        UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);

        FontSet fontSet = FontSets.createDefaultFontSet(
                //                    new Font("Tahoma", Font.PLAIN, 11), // control font
                //                    new Font("Tahoma", Font.PLAIN, 11), // menu font
                //                    new Font("Tahoma", Font.PLAIN, 11) // title font
                //                    new Font("Sans", Font.PLAIN, 11), // control font
                //                    new Font("Sans", Font.PLAIN, 11), // menu font
                //                    new Font("Sans", Font.PLAIN, 11) // title font
                new Font("Verdana", Font.PLAIN, 12), // control font
                new Font("Verdana", Font.PLAIN, 12), // menu font
                new Font("Verdana", Font.PLAIN, 12) // title font
        );
        FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet);
        PlasticXPLookAndFeel.setFontPolicy(fixedPolicy);
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());

        //            System.out.println("getControlTextFont:" + PlasticXPLookAndFeel.getControlTextFont());
        //            System.out.println("getTitleTextFont:" + PlasticXPLookAndFeel.getTitleTextFont());
        //            System.out.println("getMenuTextFont:" + PlasticXPLookAndFeel.getMenuTextFont());
        //            System.out.println("getPlasticTheme:" + PlasticXPLookAndFeel.getPlasticTheme());

        //            UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
        //UIManager.setLookAndFeel(systemlaf);

    } catch (Exception ex) {
        log.error("Exception", ex);
    }
}

From source file:cytoscape.CyMain.java

License:Open Source License

protected void setupLookAndFeel() {
    try {/*from   w ww .j a v  a 2 s  . c o  m*/
        if (LookUtils.IS_OS_WINDOWS) {
            /*
             * For Windows: just use platform default look & feel.
             */
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } else if (LookUtils.IS_OS_MAC) {
            /*
             * For Mac: move menu bar to OS X default bar (next to Apple
             * icon)
             */
            System.setProperty("apple.laf.useScreenMenuBar", "true");

        } else {
            final JavaVersion javaVersion = JavaVersion.getJavaVersion();
            if (javaVersion.getMajor() >= 2 || javaVersion.getMinor() > 6
                    || (javaVersion.getMinor() == 6 && javaVersion.getUpdate() >= 10))
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
            else {
                /*
                 * For Unix platforms, use JGoodies Looks
                 */
                UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
                Plastic3DLookAndFeel.set3DEnabled(true);
                Plastic3DLookAndFeel.setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer());
                Plastic3DLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
                Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);

                Options.setDefaultIconSize(new Dimension(18, 18));
                Options.setHiResGrayFilterEnabled(true);
                Options.setPopupDropShadowEnabled(true);
                Options.setUseSystemFonts(true);

                UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
                UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
            }
        }
    } catch (Exception e) {
        logger.warn("Can't set look & feel:" + e.getMessage(), e);
    }
}

From source file:de.xplib.xdbm.ui.Application.java

License:Open Source License

/**
 * Sets global user interface options.// w ww  . j  a  v a2  s.c o m
 */
private void configureUI() {

    Options.setDefaultIconSize(new Dimension(18, 18));

    // Set font options      
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts());
    Options.setGlobalFontSizeHints(settings.getFontSizeHints());
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());
    Options.setPopupDropShadowEnabled(settings.isPopupDropShadowEnabled().booleanValue());

    // Global options
    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    // Swing Settings
    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    // Work around caching in MetalRadioButtonUI
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        System.out.println("Can't change L&F: " + e);
    }
}

From source file:etomica.virial.cluster2.mvc.view.ApplicationUI.java

License:Mozilla Public License

/**
 * Configures the default UI settings, including look and feel and theme.
 *//*from   w  w  w  .  ja v a  2 s  .c o m*/
protected static JGoodiesSettings defaultUISettings() {

    JGoodiesSettings settings = JGoodiesSettings.createDefault();
    settings.setSelectedLookAndFeel(getLookAndFeel());
    settings.setTabIconsEnabled(true);
    settings.setSelectedTheme(getTheme()); // PlasticLookAndFeel.createMyDefaultTheme()
    // Configure more settings here.
    UIManager.put("Application.useSystemFontSettings", Boolean.TRUE);
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    return settings;
}

From source file:loci.visbio.util.LAFUtil.java

License:Open Source License

/** Initializes some look and feel parameters. */
public static void initLookAndFeel() {
    if (System.getProperty("swing.defaultlaf") == null) {
        // use JGoodies Plastic 3D as default if no Look & Feel is set
        try {/*from w w  w .  j a  va 2s  .  co  m*/
            UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        } catch (final Exception exc) {
            exc.printStackTrace();
        }
    }

    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    Options.setDefaultIconSize(new Dimension(18, 18));

    if (!isMacLookAndFeel()) {
        System.setProperty("apple.laf.useScreenMenuBar", "false");
    }
    UIManager.installLookAndFeel("JGoodies Windows", "com.jgoodies.plaf.windows.ExtWindowsLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic", "com.jgoodies.plaf.plastic.PlasticLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic 3D", "com.jgoodies.plaf.plastic.Plastic3DLookAndFeel");
    UIManager.installLookAndFeel("JGoodies Plastic XP", "com.jgoodies.plaf.plastic.PlasticXPLookAndFeel");
}

From source file:musite.MusiteMain.java

License:Open Source License

private static void setupLookAndFeel() {
    try {/*from ww w  .j a va  2  s  .co m*/
        if (SystemUtils.IS_OS_WINDOWS) {
            /*
             * For Windows: just use platform default look & feel.
             */
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } else if (SystemUtils.IS_OS_MAC) {
            /*
             * For Mac: move menue bar to OS X default bar (next to Apple
             * icon)
             */
            System.setProperty("apple.laf.useScreenMenuBar", "true");
        } else {
            /*
             * For Unix platforms, use JGoodies Looks
             */
            UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
            Plastic3DLookAndFeel.set3DEnabled(true);
            Plastic3DLookAndFeel.setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer());
            Plastic3DLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE);
            Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true);

            Options.setDefaultIconSize(new Dimension(18, 18));
            Options.setHiResGrayFilterEnabled(true);
            Options.setPopupDropShadowEnabled(true);
            Options.setUseSystemFonts(true);

            UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
            UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.codjo.standalone.client.DbaWindow.java

License:Apache License

private static void configureLookAndFeel() {
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    Options.setGlobalFontSizeHints(FontSizeHints.MIXED);
    Plastic3DLookAndFeel.setMyCurrentTheme(new ExperienceBlue());
    try {/*from  w w w .j  av  a  2  s .  co  m*/
        UIManager.setLookAndFeel(new Plastic3DLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        ;
    }
}

From source file:net.dpml.depot.desktop.Desktop.java

License:Apache License

/**
 * Configures the UI; tries to set the system look on Mac, 
 * WindowsLookAndFeel on general Windows, and
 * Plastic3DLookAndFeel on Windows XP and all other OS.
 *//* w w w.  j av a 2  s  . com*/
private void configureUI() {
    Options.setDefaultIconSize(new Dimension(18, 18));

    // Set font options      
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts());
    Options.setGlobalFontSizeHints(settings.getFontSizeHints());
    Options.setUseNarrowButtons(settings.isUseNarrowButtons());

    Options.setTabIconsEnabled(settings.isTabIconsEnabled());
    UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled());

    LookAndFeel selectedLaf = settings.getSelectedLookAndFeel();
    if (selectedLaf instanceof PlasticLookAndFeel) {
        PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    // MetalRadioButtonUI caching work around
    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);

    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:net.dpml.depot.prefs.DepotPreferencesFrame.java

License:Apache License

private void configureUI() {

    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    Options.setGlobalFontSizeHints(FontSizeHints.MIXED);
    Options.setDefaultIconSize(new Dimension(18, 18));

    String lafName = LookUtils.IS_OS_WINDOWS_XP ? Options.getCrossPlatformLookAndFeelClassName()
            : Options.getSystemLookAndFeelClassName();

    com.jgoodies.looks.plastic.PlasticLookAndFeel
            .setMyCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBlue());
    try {//from  w  w w .ja  v  a 2 s . co m
        UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }
}

From source file:progresswatcher.GuiHelper.java

License:Open Source License

/**
 * Set a new look and feel//from  ww  w . j  a v  a2 s  .c  o  m
 */
public static void configureUI() {
    UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE);
    Options.setDefaultIconSize(new Dimension(18, 18));

    String lafName = LookUtils.IS_OS_WINDOWS_XP ? Options.getCrossPlatformLookAndFeelClassName()
            : Options.getSystemLookAndFeelClassName();

    try {
        UIManager.setLookAndFeel(lafName);
    } catch (Exception e) {
        System.err.println("Can't set look & feel:" + e);
    }
}