Here you can find the source of setUIFont(javax.swing.plaf.FontUIResource f)
Parameter | Description |
---|---|
a | Font for all components of actual JFrame. |
public static void setUIFont(javax.swing.plaf.FontUIResource f)
//package com.java2s; //License from project: Open Source License import java.awt.Font; import java.util.Enumeration; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; public class Main { /**// w w w . j av a 2s . c o m * Forces a default Font for all components of actual JFrame. * * @param a * Font for all components of actual JFrame. */ public static void setUIFont(javax.swing.plaf.FontUIResource f) { Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource orig = (FontUIResource) value; Font font = new Font(f.getFontName(), orig.getStyle(), f.getSize()); UIManager.put(key, new FontUIResource(font)); } } } }