Here you can find the source of setUIFont(FontUIResource f)
Parameter | Description |
---|---|
f | the font to use |
public static void setUIFont(FontUIResource f)
//package com.java2s; /**//from w ww .j ava2 s . com * Distribution License: * JSword is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License, version 2.1 as published by * the Free Software Foundation. This program is distributed in the hope * that it will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * The License is available on the internet at: * http://www.gnu.org/copyleft/lgpl.html * or by writing to: * Free Software Foundation, Inc. * 59 Temple Place - Suite 330 * Boston, MA 02111-1307, USA * * Copyright: 2005 * The copyright to this program is held by it's authors. * * ID: $Id: LookAndFeelUtil.java 2056 2010-12-12 04:34:41Z dmsmith $ */ import java.util.Enumeration; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; public class Main { /** * Set the default font for all Swing components. E.g. * <code>setUIFont(new FontUIResource("Serif", Font.ITALIC, 12));</code> <br/> * Note: a single resources can be changed with: * <code>UIManager.put("Label.font", new Font("Serif", Font.ITALIC, 12));</code> * * @param f * the font to use */ public static void setUIFont(FontUIResource f) { Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { // System.err.println(key + " = " + value); UIManager.put(key, f); } } } }