Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Font;

import javax.swing.UIManager;

import javax.swing.plaf.FontUIResource;

public class Main {
    public static void setUIFont(Font f) {
        //
        // sets the default font for all Swing components.
        // ex. 
        //  setUIFont (new javax.swing.plaf.FontUIResource("Serif",Font.ITALIC,12));
        //
        FontUIResource fur = new FontUIResource(f);
        java.util.Enumeration keys = UIManager.getDefaults().keys();
        while (keys.hasMoreElements()) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof javax.swing.plaf.FontUIResource)
                UIManager.put(key, fur);
        }
    }
}