下面是 JFrame 窗口事件处理方法,自己读一下: protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { switch(defaultCloseOperation) { case HIDE_ON_CLOSE: setVisible(false); break; case DISPOSE_ON_CLOSE: dispose(); break; case DO_NOTHING_ON_CLOSE: default: break; case EXIT_ON_CLOSE: // This needs to match the checkExit call in // setDefaultCloseOperation System.exit(0); break; } } }
楼主【sure2003】截止到2008-07-15 14:35:31的历史汇总数据(不包括此帖):
发帖的总数量:241 发帖的总分数:10243 每贴平均分数:42
回帖的总数量:205 得分贴总数量:6 回帖的得分率:2%
结贴的总数量:236 结贴的总分数:10053
无满意结贴数:2 无满意结贴分:50
未结的帖子数:5 未结的总分数:190
结贴的百分比:97.93 % 结分的百分比:98.15 %
无满意结贴率:0.85 % 无满意结分率:0.50 %
值得尊敬
比java.awt.Frame中需要自己写WindowClosing处理轻松多了。
EXIT_ON_CLOSE 是点X的话 关闭
super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) {
switch(defaultCloseOperation) {
case HIDE_ON_CLOSE:
setVisible(false);
break;
case DISPOSE_ON_CLOSE:
dispose();
break;
case DO_NOTHING_ON_CLOSE:
default:
break;
case EXIT_ON_CLOSE:
// This needs to match the checkExit call in
// setDefaultCloseOperation
System.exit(0);
break;
}
}
}