Example usage for com.jgoodies.looks FontSets createDefaultFontSet

List of usage examples for com.jgoodies.looks FontSets createDefaultFontSet

Introduction

In this page you can find the example usage for com.jgoodies.looks FontSets createDefaultFontSet.

Prototype

public static FontSet createDefaultFontSet(Font controlFont) 

Source Link

Document

Creates and returns a FontSet that is based only on the given control font.

Usage

From source file:br.arthur.temp.tests.JCalendarDemo.java

License:Open Source License

/**
 * Installs the JGoodies Look & Feels, if available, in classpath.
 */// w  ww  .  j  a  v a  2  s  . c  om
public final void initializeLookAndFeels() {
    // if in classpath thry to load JGoodies Plastic Look & Feel
    try {
        LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels();
        boolean found = false;
        for (int i = 0; i < lnfs.length; i++) {
            if (lnfs[i].getName().equals("JGoodies Plastic 3D")) {
                found = true;
            }
        }
        if (!found) {
            UIManager.installLookAndFeel("JGoodies Plastic 3D",
                    "com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
        }
        String os = System.getProperty("os.name");
        FontSet fontSet = null;
        if (os.startsWith("Windows")) {
            fontSet = FontSets.createDefaultFontSet(new Font("arial unicode MS", Font.PLAIN, 12));
        } else {
            fontSet = FontSets.createDefaultFontSet(new Font("arial unicode", Font.PLAIN, 12));
        }
        FontPolicy fixedPolicy = FontPolicies.createFixedPolicy(fontSet);
        PlasticLookAndFeel.setFontPolicy(fixedPolicy);

        UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
    } catch (Throwable t) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}