日期:2014-05-20 浏览次数:20718 次
import java.awt.*; import javax.swing.*; public class B extends JFrame{ private JTextField jt1; private JLabel jl1,jl2,jl3; private JPasswordField mima; private JButton jb1,jb2; private JPanel jp1=new JPanel(); private JPanel jp2=new JPanel(); private JPanel jp3=new JPanel(); private BorderLayout bb=new BorderLayout(); public B(){ super("qq2010"); this.setLayout(bb); jl1=new JLabel("用户名:"); jl2=new JLabel("密码:"); mima=new JPasswordField (10); jt1=new JTextField(10); jb1=new JButton("注册"); jb2=new JButton("登陆"); jp1.add(jl1); jp1.add(jt1); jp1.add(jl2); jp1.add(mima); jp2.add(jb1); jp2.add(jb2); jl3=new JLabel("img"); add(jl3,BorderLayout.NORTH); add(jp1,BorderLayout.CENTER); add(jp2,BorderLayout.SOUTH); this.setSize(200,200); this.setVisible(true); } public static void main(String[] args){ B b=new B(); b.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }