放在程序载入界面前,比如 main() 方法最前面
//全局字体设置-----------------------// Font font = new Font("宋体",Font.PLAIN,14); UIManager.put("Button.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("RadioButton.font",font);
UIManager.put("CheckBox.font",font);
UIManager.put("ColorChooser.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("ComboBox.font",font);
UIManager.put("ComboBoxItem.font",font);
UIManager.put("InternalFrame.titleFont",font);
UIManager.put("Label.font",font);
UIManager.put("List.font",font);
UIManager.put("MenuBar.font",font);
UIManager.put("Menu.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("RadioButtonMenuItem.font",font);
UIManager.put("CheckBoxMenuItem.font",font);
UIManager.put("PopupMenu.font",font);
UIManager.put("OptionPane.font",font);
UIManager.put("OptionPane.messageFont",font);
UIManager.put("OptionPane.buttonFont",font);
UIManager.put("Panel.font",font);
UIManager.put("ProgressBar.font",font);
UIManager.put("ScrollPane.font",font);
UIManager.put("Viewport",font);
UIManager.put("TabbedPane.font",font);
UIManager.put("TableHeader.font",font);
UIManager.put("TextField.font",font);
UIManager.put("PasswordFiled.font",font);
UIManager.put("TextArea.font",font);
UIManager.put("TextPane.font",font);
UIManager.put("EditorPane.font",font);
UIManager.put("TitledBorder.font",font);
UIManager.put("ToolBar.font",font);
UIManager.put("ToolTip.font",font);
UIManager.put("Tree.font",font);
UIManager.put("Table.font",font);
//全局字体设置-----------------------// Font font = new Font("宋体",Font.PLAIN,14); UIManager.put("Button.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("RadioButton.font",font);
UIManager.put("CheckBox.font",font);
UIManager.put("ColorChooser.font",font);
UIManager.put("ToggleButton.font",font);
UIManager.put("ComboBox.font",font);
UIManager.put("ComboBoxItem.font",font);
UIManager.put("InternalFrame.titleFont",font);
UIManager.put("Label.font",font);
UIManager.put("List.font",font);
UIManager.put("MenuBar.font",font);
UIManager.put("Menu.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("RadioButtonMenuItem.font",font);
UIManager.put("CheckBoxMenuItem.font",font);
UIManager.put("PopupMenu.font",font);
UIManager.put("OptionPane.font",font);
UIManager.put("OptionPane.messageFont",font);
UIManager.put("OptionPane.buttonFont",font);
UIManager.put("Panel.font",font);
UIManager.put("ProgressBar.font",font);
UIManager.put("ScrollPane.font",font);
UIManager.put("Viewport",font);
UIManager.put("TabbedPane.font",font);
UIManager.put("TableHeader.font",font);
UIManager.put("TextField.font",font);
UIManager.put("PasswordFiled.font",font);
UIManager.put("TextArea.font",font);
UIManager.put("TextPane.font",font);
UIManager.put("EditorPane.font",font);
UIManager.put("TitledBorder.font",font);
UIManager.put("ToolBar.font",font);
UIManager.put("ToolTip.font",font);
UIManager.put("Tree.font",font);
UIManager.put("Table.font",font);
解决方案 »
- xml遍历问题,死循环,大家帮忙看看这个方法什么问题
- java swing如何实现首行固定不动可以通过滚动条控制其它列水平滚动
- 这个程序为什么通过不了编译?关于Graphics2D的问题
- Uncaught exception 的问题 高人请进 !!!
- 请问怎么吧ARRAYLIST里面的数值加入到一个String[]变量中啊
- ★☆java收我用vb+winsock写的数据有问题~收到null,或是关闭winsock后才能收到★☆
- 哪位给段java直接连接SQL2000的完整代码(不通过ODBC),驱动我已经装了,要完整的~~马上结帖
- jbuilder7里如何在project pane里显示出某个project的所有的类的结构图,就如显示source java files的结构图一样
- Java程序与SQL Server数据库连接。。
- 散分啦!来者有分!
- 求助 求幂集
- 救助正则表达式的问题
好像不行啊?!我是用SWING进行开发!
import java.awt.event.*;
import javax.swing.*;
public class Test extends JFrame {
public Test() {
makeFace();
addListener();
showFace();
}
private void makeFace() {
Container contentPane = this.getContentPane();
contentPane.add(new JButton("按钮1"), BorderLayout.NORTH);
contentPane.add(new JLabel("标签1"), BorderLayout.CENTER);
contentPane.add(new JTextField("文本筐1"), BorderLayout.SOUTH);
}
private void addListener() {
this.addWindowListener(new WindowAdapter(){ //添加窗口关闭事件
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
}
private void showFace(){
setLocation(200,200);
pack();
show();
}
public static void main(String[] args) {
try {
String laf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(laf);
} catch (Exception exc) { }
//全局字体设置
Font font1 = new Font("宋体",Font.PLAIN,7);
Font font2 = new Font("宋体",Font.PLAIN,30);
Font font3 = new Font("宋体",Font.PLAIN,13);
UIManager.put("Button.font",font2);
UIManager.put("TextField.font",font1);
UIManager.put("Label.font",font3);
new Test();
}
}
你先别急嘛,我这几天都没空上网,刚了,OK!非常感谢!!!
强烈感谢!继续努力!