我看了好多帖子用的都是
先导入
import javax.swing.UIManager;
然后可以在构造器里加上下面的代码,我是这样做的,你只要加上JFrame相应的字体就好了!
try {
Font commonFont = new Font("Courier",Font.PLAIN,12);
Font titleFont = new Font("Courier",Font.ITALIC,12);
UIManager.getDefaults().put( "TextField.inactiveForeground", Color.darkGray);
UIManager.getDefaults().put( "Button.font",commonFont);
UIManager.getDefaults().put( "ComboBox.font",commonFont);
UIManager.getDefaults().put( "CheckBox.font",commonFont);
UIManager.getDefaults().put( "Label.font", commonFont);
UIManager.getDefaults().put( "Menu.font", commonFont);
UIManager.getDefaults().put( "MenuBar.font", commonFont);
UIManager.getDefaults().put( "MenuItem.font", commonFont);
UIManager.getDefaults().put( "RadioButtonMenuItem.font", commonFont);
UIManager.getDefaults().put( "TabbedPane.font",commonFont);
UIManager.getDefaults().put( "ToggleButton.font",commonFont);
UIManager.getDefaults().put( "TitledBorder.font",titleFont);
UIManager.getDefaults().put("List.font",commonFont);
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
e.printStackTrace();
}
但是不行为什么?
先导入
import javax.swing.UIManager;
然后可以在构造器里加上下面的代码,我是这样做的,你只要加上JFrame相应的字体就好了!
try {
Font commonFont = new Font("Courier",Font.PLAIN,12);
Font titleFont = new Font("Courier",Font.ITALIC,12);
UIManager.getDefaults().put( "TextField.inactiveForeground", Color.darkGray);
UIManager.getDefaults().put( "Button.font",commonFont);
UIManager.getDefaults().put( "ComboBox.font",commonFont);
UIManager.getDefaults().put( "CheckBox.font",commonFont);
UIManager.getDefaults().put( "Label.font", commonFont);
UIManager.getDefaults().put( "Menu.font", commonFont);
UIManager.getDefaults().put( "MenuBar.font", commonFont);
UIManager.getDefaults().put( "MenuItem.font", commonFont);
UIManager.getDefaults().put( "RadioButtonMenuItem.font", commonFont);
UIManager.getDefaults().put( "TabbedPane.font",commonFont);
UIManager.getDefaults().put( "ToggleButton.font",commonFont);
UIManager.getDefaults().put( "TitledBorder.font",titleFont);
UIManager.getDefaults().put("List.font",commonFont);
// UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception e) {
e.printStackTrace();
}
但是不行为什么?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货