Here you can find the source of setUIFont(FontUIResource f)
@SuppressWarnings("rawtypes") public static void setUIFont(FontUIResource f)
//package com.java2s; /**// w w w . j av a 2 s. c o m * ============================================================================================ * Menthor Editor -- Copyright (c) 2015 * * This file is part of Menthor Editor. Menthor Editor is based on TinyUML and as so it is * distributed under the same license terms. * * Menthor Editor is free software; you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * Menthor Editor 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 General Public License for more details. * * You should have received a copy of the GNU General Public License along with Menthor Editor; * if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * ============================================================================================ */ import java.awt.Font; import java.util.Enumeration; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; public class Main { @SuppressWarnings("rawtypes") public static void setUIFont(FontUIResource f) { Enumeration 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)); } } } }