简单,在main函数里调用下面的代码:
  Font font=new Font("宋体",Font.PLAIN,15);//这个就是设置的字体
  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("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);

解决方案 »

  1.   

    你好想得继承你想改变自体的组件,然后重写getFont()方法;
    然后你把这些类封装在一起,定义一个借口,你就可以随时改变你想改变的字体!
    仅供参考:)
      

  2.   

    /*
      *ÉèÖóÌÐò×ÖÌå
      */
    private void makeFont(){
     try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     Font font=new Font("JDialog",Font.PLAIN,12);
     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(int i=0;i<names.length;i++){
    UIManager.put(names[i]+".font",font);
    }
    UIManager.put("OptionPane.messageFont",font);
    UIManager.put("OptionPane.buttonFont",font);
    UIManager.put("Label.foreground",Color.black);
    UIManager.put("Border.foreground",Color.black);
    UIManager.put("TitledBorder.titleColor",Color.black);
    }catch(Exception e){
       e.printStackTrace();
    }
    }
      

  3.   

    如beyond_xiruo所写的,其实,只要改变界面的东西,基本上都可以使用javax.swing包中的UIManager来实现
      

  4.   

    楼上大侠:你们的代码好像不起作用呀:
    我把代码放在jbInit()的最后面,可是不起作用!是不是还有什么地方没做?
      

  5.   

    xiruo:可以了1、能解释一下为什么吗?应该放那里都是一样吧,不都是对UIManager进行处理,
    下面这句话没放在main()的最前面,不也可以吗?
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");2、现在是连从主窗体打开的子窗体也都变了,是不是在main()里一设,整个程序都会有影响呀?
      

  6.   

    你将下面这句放到最后看看,一样没有效果
    UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    我的理解是,UI是自动被调用的,通常要在UI第一次被调用前改变它
    而且UI是对整个application的,所以打开的子窗口也变啦
      

  7.   

    对,同意beyond_xiruo(又再次无奈的离开),每个组件在new之前都会先调用UI判断UI,所以你放到构造函数的最前面也可以,这么说,我觉得哪个UI你不改变,那在上面函数里你不加设置他UI的句子就可以了,我是这么觉得,你试试