set UI Font - Java 2D Graphics

Java examples for 2D Graphics:Font

Description

set UI Font

Demo Code


//package com.java2s;
import java.util.Enumeration;
import javax.swing.UIManager;
import javax.swing.plaf.FontUIResource;

public class Main {
    public static void setUIFont(FontUIResource f) {
        Enumeration keys = UIManager.getDefaults().keys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);

            if (value instanceof FontUIResource) {
                UIManager.put(key, f);
            }/*from www.j a  va 2 s.c o m*/
        }
    }
}

Related Tutorials