package com.frametest;
import java.awt.*;
public class FrameTest { /**
 * @param args
 */
public static void main(String[] args) {
// TODO Auto-generated method stub
Frame f = new Frame("www.Jcson");
f.add(new Button("confirm")); //曾加按钮.
f.setSize(1000, 900);
f.setVisible(true); //设置可见.
try {
Thread.sleep(2000); //线程休息2秒.
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
//f.setVisible(false);
f.addWindowListener(new YourWindowListener()); //添加YourWindowListener实例.

}}import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class YourWindowListener extends WindowAdapter {  //继承WindowAdapter类.
public void windowClosing(WindowEvent e){
e.getWindow().setVisible(false); //设置不可见.
e.getWindow().dispose(); //关闭窗口.
System.exit(0);
}
}请问,为什么运行时的窗口有时点击一次可以关闭,有时要点击两三次才能关闭,好奇怪!!