new 一个Font,它可以设置字体样式,对你需要修改字体的组件这样来做setFont(myFong);

解决方案 »

  1.   

    在你的组件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);
      

  2.   

    //修改 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)); }