/** * Sets the default UI font style. * * @param fontStyle * The font style * @see Font See Font Javadoc for possible styles */ public static void setUIFontStyle(final int fontStyle) { for (Enumeration<?> en = UIManager.getDefaults().keys(); en.hasMoreElements();) { Object key = en.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { FontUIResource fontRes = (FontUIResource) value; UIManager.put(key, new ProxyLazyValue("javax.swing.plaf.FontUIResource", null, new Object[] { fontRes.getName(), fontStyle, fontRes.getSize() })); } } }
private static ProxyLazyValue lazyValueForFont(final String fontName, final int style, final int size) { return new UIDefaults.ProxyLazyValue("javax.swing.plaf.FontUIResource", new Object[] {fontName, new Integer(style), new Integer(size)}); }