import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class r extends JFrame implements ActionListener
{
public static void main(String[] args)
{
new r();
}
r()
{
r.b=new JButton("点我试试");
r.b.addActionListener(this);
add(r.b);
setSize(300,200);
setLocationRelativeTo(null);
pack();
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e)
{
remove(r.b);
repaint();
}
static JButton b;
}
温馨提示:答案为网友推荐,仅供参考