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);

解决方案 »

  1.   

    如楼上:
    TitledBorder.border                    =javax.swing.plaf.BorderUIResource$LineBorderUIResource@482923(默认值)TitledBorder.font =javax.swing.plaf.FontUIResource[family=dialog.bold,name=Dialog,style=bold,size=12]TitledBorder.titleColor =javax.swing.plaf.ColorUIResource[r=102,g=102,b=153]
      

  2.   

    谢谢二位 ,我们只能用SWT来实现,而不能用SWING和AWT来做。。
    以下代码是实现 改变菜单字体的颜色和大小的代码,但是,请问怎样用SWT来改变菜单字体的颜色和大小呢??
    import java.awt.event.ActionListener;import org.eclipse.draw2d.ActionEvent;
    import org.eclipse.draw2d.CheckBox;
    import org.eclipse.swt.*;
    import org.eclipse.swt.widgets.*;import org.eclipse.swt.custom.StyleRange;
    import org.eclipse.swt.events.SelectionEvent;
    import org.eclipse.swt.events.SelectionListener;
    import org.eclipse.swt.graphics.Color;
    import org.eclipse.swt.graphics.Font;
    import org.eclipse.swt.layout.*;public class Button2222 { public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(300, 300);
    shell.setText("Welcome   to   you !");
    Label label = new Label(shell, SWT.NONE);
    //label.setsize(50,50);
    Color red = new Color(display, 255, 38, 44);
    label.setForeground(red);
    label.setText("YOUR NAME:");
    //label.setBackground(Red); // Font font = new Font (display, "Courier", 30, SWT.NORMAL);
    Font font = new Font(display, "Courier", 30, SWT.BOLD); label.setFont(font); Text text = new Text(shell, SWT.BORDER); text.setLayoutData(new RowData(300, SWT.DEFAULT));
    Button ok = new Button(shell, SWT.PUSH); Color blue = new Color(display, 0, 0, 225);
    ok.setForeground(blue);
    ok.setText("Ok"); ok.addSelectionListener(new SelectionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("Ok,System accept your information!");
    } public void widgetSelected(SelectionEvent arg0) {
    // TODO Auto-generated method stub } public void widgetDefaultSelected(SelectionEvent arg0) {
    // TODO Auto-generated method stub } }); ok.setFont(font); Button cancel = new Button(shell, SWT.PUSH);
    cancel.setForeground(red);
    cancel.setText("Cancel");
    // cancel.
    cancel.setFont(font);
    shell.setDefaultButton(cancel);
    shell.setLayout(new RowLayout()); shell.open();
    while (!shell.isDisposed()) {
    if (!display.readAndDispatch())
    display.sleep();
    }
    display.dispose();
    shell.dispose();
    red.dispose();
    font.dispose();
    }
    }
      

  3.   

    不好意思说错话了。。
    以下代码是实现 改变菜单字体的颜色和大小的代码,但是,请问怎样用SWT来改变菜单栏字体的颜色和大小呢??