UIManager.setLookAndFeel(“ com.sun.java.swing.plaf.windows.WindowsLookAndFeel ”);//windows默认
UIManager.put("MenuBar.font", font);//给控件设置字体
static Object | put (Object key, Object value) |
public static void setLookAndFeel(String className, java.awt.Component c) {
try {
UIManager.setLookAndFeel(className);
SwingUtilities.updateComponentTreeUI(c);//注意这行
}
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null,
"不好意思,setLookAndFeel时出错了:( Errormsg:" + ex,
"setLookAndFeel",
JOptionPane.INFORMATION_MESSAGE);
}