分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.youkuaiyun.com/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
1、[原创]Swing技巧.1:用最少的代码设置frame的默认关闭事件
设置默认关闭事件
对JFrame,JDialog,JInternalFrame有效
setDefaultCloseOperation(EXIT_ON_CLOSE);
可用参数在javax.swing.WindowConstants内(JFrame,JDialog,JInternalFrame都实现了)
DO_NOTHING_ON_CLOSE = 0;
HIDE_ON_CLOSE = 1;
DISPOSE_ON_CLOSE = 2;
EXIT_ON_CLOSE = 3;
2、使用內部類實現窗體關閉事件的捕獲
protected static class CloseHandler
extends WindowAdapter
{
public void windowClosing(final WindowEvent event)
{
//要做的動作
System.exit(0);
}
}
在類中用 this.addWindowListener(new CloseHandler()); 實現捕獲给我老师的人工智能教程打call!http://blog.youkuaiyun.com/jiangjunshow
