package disici; import java.awt.Color; import java.awt.event.*; import javax.swing.*; public class abc implements ActionListener{ JFrame f,f1; JPanel p,p1; JButton b,b1; JLabel l1,l2,l3; JTextField t1,t2,t3; public abc() { f = new JFrame("登录窗口"); f1 = new JFrame(); p = new JPanel(); p1 = new JPanel(); b = new JButton ("注册"); l1= new JLabel("用户名:"); l2= new JLabel("密码:"); t1=new JTextField(10); t2=new JTextField(10); t3=new JTextField(10); b.addActionListener(this); f.add(p); p.add(b); f.setSize(400,300); f.setVisible(true); } public static void main(String[]args) { new abc(); } @Override public void actionPerformed(ActionEvent e) { p1.setBackground(Color.pink); f1= new JFrame(); l1= new JLabel("用户名:"); t1=new JTextField(10); l2= new JLabel("密码:"); t2=new JTextField(10); l3 = new JLabel("确认密码"); b1 = new JButton ("注册"); t3=new JTextField(10); f1.setBounds(600, 600,200 ,150 ); f1.setSize(400,300); f1.setVisible(true); p1=new JPanel(); p1.add(l3); p1.add(t3); p1.add(l2); p1.add(t2); p1.add(l1); p1.add(t1); f1.add(p1); p.add(b1); p1.setBackground(Color.orange); } }