package 上机; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class wind implements ActionListener { JFrame f,f1; JPanel p,p1; JButton b,b1; public wind() { f = new JFrame(); f1 = new JFrame(); p = new JPanel(); p1 = new JPanel(); b = new JButton("登录"); b.addActionListener(this); f.setSize(400,400); f.add(p); p.add(b); f.setVisible(true); } public static void main(String[] args) { new wind(); } @Override public void actionPerformed(ActionEvent e) { f.setVisible(false); b1 = new JButton("注册"); f1.setSize(400,400); f1.add(p1); p1.add(b1); f1.setVisible(true); // TODO Auto-generated method stub } }