日期:2014-05-20  浏览次数:20653 次

很简单为什么什么 都不能显示呢
Java code


import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.BoxLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class LoginWin extends JPanel{ 
      
    private JLabel lab;
    private JTextField jf;
    public LoginWin() {
        super();
        initGUI();
    }

    private void initGUI() {
        setSize(200, 200);
        jf = new JTextField();
        lab = new JLabel();    
        this.setLayout(null);
        lab.setBounds(30,30,120,30);
        jf.setBounds(30,80,120,30);
    }
    
    public static void main(String args[]){
        JFrame jff = new JFrame();
        Container con = jff.getContentPane();
        con.setLayout(new FlowLayout());
        LoginWin lw = new LoginWin();
        con.add(lw);
        jff.setSize(300, 200);
        jff.setVisible(true);
    }
}




------解决方案--------------------
学习