由于Swing中默认都是使用了tohoma字体,而不是
Dialog 这样的family font。
public class Main {
@SuppressWarnings("unchecked")
public static void initGlobalFontSetting(Font fnt) {
FontUIResource fontRes = new FontUIResource(fnt);
for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof FontUIResource)
UIManager.put(key, fontRes);
}
}
public static void main(String args[]) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(new org.jvnet.substance.skin.SubstanceOfficeBlue2007LookAndFeel());
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
initGlobalFontSetting(new Font("微软雅黑",Font.PLAIN,12));
new MainFrame();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
分享到:
评论