1:先运行一下
2:为什么"code = new JLabel("输入管理员密码");"这个运行起来都是"口口口口口口口口口口口" ,怎么解决,我想模拟windows的各种GUI 窗口,对话框,字幕,等等!//package pack;import javax.swing.*; 
import java.util.*;
import java.lang.String.*;
import java.awt.event.*;
import java.awt.*;
import java.lang.*;
import java.io.*;class CodeFrame extends JFrame 
{
JLabel code;
JPasswordField codtext;
JPanel panel1;
JPanel panel2;
public CodeFrame(String s)
{   
    super(s);
    Container c = getContentPane();
    c.setLayout(new GridLayout(1,2));
    setVisible(false);
panel1=new JPanel();
panel2=new JPanel();
    code = new JLabel("输入管理员密码");
    codtext = new JPasswordField(20);
    panel1.add(code);
panel2.add(codtext);
c.add(panel1);
c.add(panel2);
    setLocation(350,250);    
setSize(300,80);
addWindowListener(new WindowAdapter()
{
    public void windowClosing(WindowEvent e)
{
               setVisible(false);
   System.exit(0);
}
});
}
}public class Code //extends JFrame 
{
public static void main(String args[]) throws Exception
{   
    try 
    {   
        CodeFrame window = new CodeFrame("銮辰库存管理系统");
        String str = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
UIManager.setLookAndFeel(str);
SwingUtilities.updateComponentTreeUI(window);
window.setVisible(true);
    } 
    catch(Exception e) 
        { 
        
        }
}
}

解决方案 »

  1.   

    //定义修改字体的方法
    private static void setUIFont(Font font)
    {
        Enumeration keys = UIManager.getDefaults().keys();
        while(keys.hasMoreElements())
        {
            Object key=keys.nextElement();
            Object value=UIManager.get(key);
            if(value instanceof javax.swing.plaf.FontUIResource)
            UIManager.put(key,font);
        }
    }
    //在主函数中调用方法修改UI的字体
    setUIFont(new Font("Dialog",Font.PLAIN,12));
    //下面是在主函数中改界面,要放在实例化窗口之前
    try
    {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
    catch(Exception e)
    {
        throw new RuntimeException(e);
    }
      

  2.   

    JAVA默认的是11号字体,皱巴巴的很难看,用上面的方法可以修改系统默认字体,但是JOptionPane的字体还是没能改回来,我是用笨方法来改的,有兴趣知道的话加我QQ:64027424,谁知道怎么简单的改JOptionPane的字体也请加我QQ,告诉我一下,谢谢~
      

  3.   

    用 SWT 做出来的界面就跟你的系统界面一致了