Java swing更改全局字体

来源:互联网 发布:苹果付费画图软件 编辑:程序博客网 时间:2024/05/20 07:59

这段代码在jframe显示前调用,比如main方法开始就调用:


public static void setUIFont(){Font f = new Font("宋体",Font.PLAIN,18);String   names[]={ "Label", "CheckBox", "PopupMenu","MenuItem", "CheckBoxMenuItem","JRadioButtonMenuItem","ComboBox", "Button", "Tree", "ScrollPane","TabbedPane", "EditorPane", "TitledBorder", "Menu", "TextArea","OptionPane", "MenuBar", "ToolBar", "ToggleButton", "ToolTip","ProgressBar", "TableHeader", "Panel", "List", "ColorChooser","PasswordField","TextField", "Table", "Label", "Viewport","RadioButtonMenuItem","RadioButton", "DesktopPane", "InternalFrame"}; for (String item : names) { UIManager.put(item+ ".font",f); }}

0 0
原创粉丝点击