整体修改字体样式和字体大小应该怎么做? new 一个Font,它可以设置字体样式,对你需要修改字体的组件这样来做setFont(myFong); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在你的组件new之前使用如下的方法设置你要改变的组件的各种属性下面是设置组件的整体字体,也可以其他的如滚动条,什么什么的。 Font f=(Font)(UIManager.getDefaults().get("Menu.font")); Font font=new Font(f.getFamily(),Font.PLAIN,f.getSize()); UIManager.put("Menu.font",font); UIManager.put("MenuItem.font",font); UIManager.put("Button.font",font); UIManager.put("CheckBoxMenuItem.font",font); UIManager.put("RadioButtonMenuItem.font",font); UIManager.put("Label.font",font); UIManager.put("TabbedPane.font",font); UIManager.put("ToggleButton.font",font); //修改 UI 的默认值 Hashtable table = UIManager.getDefaults(); Enumeration enum = table.keys(); while (enum.hasMoreElements()) { Object o = enum.nextElement();// System.out.println(o + "------>" + table.get(o)); if(table.get(o) instanceof Font) UIManager.put(o, new Font("宋体", Font.PLAIN, 12)); } 经常出现无法找到main方法异常,怪了。。。。。。一个小时后结贴。 求 《JAVA与UML协同应用开发》书内所有源代码! 怎么用xml动态生成swt的界面的啊? java如何遍历Map<String, ArrayList> map = new HashMap<String, ArrayList>();(在线等) java tomcat 安装程序不能运行 如何获取本地机的屏幕尺寸 菜鸟问题:关于字符串 Jbuilder7与MSSQL2000连接的一些问题? 关于内部类 关于Java的返回值问题:太奇怪了!!! jdk1.4.2问题? 问几个基础问题,谢谢
Font font=new Font(f.getFamily(),Font.PLAIN,f.getSize());
UIManager.put("Menu.font",font);
UIManager.put("MenuItem.font",font);
UIManager.put("Button.font",font);
UIManager.put("CheckBoxMenuItem.font",font);
UIManager.put("RadioButtonMenuItem.font",font);
UIManager.put("Label.font",font);
UIManager.put("TabbedPane.font",font);
UIManager.put("ToggleButton.font",font);
Hashtable table = UIManager.getDefaults();
Enumeration enum = table.keys();
while (enum.hasMoreElements())
{
Object o = enum.nextElement();
// System.out.println(o + "------>" + table.get(o));
if(table.get(o) instanceof Font) UIManager.put(o, new Font("宋体", Font.PLAIN, 12)); }