Java Swing Font Set setFont(Font font)

Here you can find the source of setFont(Font font)

Description

set Font

License

Open Source License

Declaration

public static void setFont(Font font) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.*;
import javax.swing.plaf.FontUIResource;
import java.awt.*;
import java.util.Enumeration;

public class Main {
    public static void setFont(Font font) {
        FontUIResource fontRes = new FontUIResource(font);
        for (Enumeration<Object> keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
            Object key = keys.nextElement();
            Object value = UIManager.get(key);
            if (value instanceof FontUIResource) {
                UIManager.put(key, fontRes);
            }/*www.  ja  v a2  s  .c om*/
        }
    }
}

Related

  1. setDefaultFont(final Font font)
  2. setDefaultFont(Font font)
  3. setDefaultFont(java.awt.Font font)
  4. setFont(@Nonnull final Font font)
  5. setFont(Container container)
  6. setFont(HTMLDocument doc, Font font, Color fg)
  7. setFont(String fontName)
  8. setFontRecursively(final JComponent component, final Font font, final boolean childsOnly)
  9. setFontScale(float scale)