统一界面字体设置(其他UI设置也可用这种思想,有点像CSS)
setUIFont(new javax.swing.plaf.FontUIResource(null, Font.PLAIN, size));
public static void setUIFont(javax.swing.plaf.FontUIResource f)
{
java.util.Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements())
{
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource)
UIManager.put(key, f);
}
}
版权所有 罗明