Java Swing Font Set setWholeFont(Font f)

Here you can find the source of setWholeFont(Font f)

Description

set Whole Font

License

Open Source License

Declaration

public static void setWholeFont(Font f) 

Method Source Code

//package com.java2s;
/*/*from  ww  w . j av  a2s . co  m*/
 * Copyright (c) 2008, AIST, the University of Tokyo and General Robotix Inc.
 * All rights reserved. This program is made available under the terms of the
 * Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * General Robotix Inc.
 * National Institute of Advanced Industrial Science and Technology (AIST) 
 */

import java.awt.Font;

import java.util.Iterator;
import java.util.Set;

import javax.swing.UIDefaults;
import javax.swing.UIManager;

import javax.swing.plaf.FontUIResource;

public class Main {
    public static void setWholeFont(Font f) {
        FontUIResource fontUIResource = new FontUIResource(f);
        UIDefaults defaultTable = UIManager.getLookAndFeelDefaults();
        Set<Object> set = defaultTable.keySet();
        Iterator<Object> it = set.iterator();
        while (it.hasNext()) {
            Object o = it.next();
            if (o instanceof String) {
                String s = (String) o;
                if (s.endsWith("font") || s.endsWith("Font"))
                    UIManager.put(s, fontUIResource);
            }
        }
    }
}

Related

  1. setUIFont(javax.swing.plaf.FontUIResource f)
  2. setUIFont(javax.swing.plaf.FontUIResource f)
  3. setUIFont(javax.swing.plaf.FontUIResource font)
  4. setUIFont(String font)
  5. setUIFontStyle(final int fontStyle)
  6. trySetBorderFont(Font font, Component component)