Here you can find the source of setFont(@Nonnull final Font font)
Parameter | Description |
---|---|
font | the new font to use |
public static void setFont(@Nonnull final Font font)
//package com.java2s; import java.awt.Font; import java.util.Enumeration; import javax.annotation.Nonnull; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; public class Main { /**/*w w w . jav a2 s. co m*/ * Sets default Swing font. * IMPORTANT! Needs to be called before main frame creation * * @param font the new font to use */ public static void setFont(@Nonnull final Font font) { final FontUIResource f = new FontUIResource(font); final Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { final Object key = keys.nextElement(); final Object value = UIManager.get(key); if (value instanceof FontUIResource) { UIManager.put(key, f); } } } }