日期:2014-05-20 浏览次数:20613 次
import java.awt.*; import java.awt.event.*; class TestFrame3 extends WindowAdapter implements ActionListener { Frame f=new Frame(); public static void main(String[] args) { TestFrame3 tf=new TestFrame3(); tf.Init(); } private void Init() { f.setVisible(true); f.setSize(300,399); f.add(bt); Button bt=new Button("Blizzard O"); //bt.addActionListener(this); bt.addActionListener(new TestFrame3()); f.addWindowListener(new TestFrame3()); //f.addWindowListener(this); } public void actionPerformed(ActionEvent e) { f.dispose(); } public void windowClosing(WindowEvent e) { f.dispose(); } }
public abstract class java.awt.event.WindowAdapter implements java.awt.event.WindowListener,java.awt.event.WindowStateListener,java.awt.event.WindowFocusListener {