setDefaultCloseOperation(int operation)
来源:互联网 发布:上瘾网络剧见面会视频 编辑:程序博客网 时间:2024/04/30 18:35
由于在写程序中涉及到窗口关闭的多种情况的选择运用,所以,对窗口的四种关闭情况,做一下整理。
public void setDefaultCloseOperation(int operation):
默认关闭状态:JFrame.class中: private int defaultCloseOperation =HIDE_ON_CLOSE;
因此,默认情况下,关闭窗口,只隐藏界面,不释放占用的内存。
点击窗口右上角关闭,四种关闭方式:
1.this.setDefaultCloseOperation(0);// DO_NOTHING_ON_CLOSE,不执行任何操作。
2.this.setDefaultCloseOperation(1);//HIDE_ON_CLOSE,只隐藏界面,setVisible(false)。
3.this.setDefaultCloseOperation(2);//DISPOSE_ON_CLOSE,隐藏并释放窗体,dispose(),当最后一个窗口被释放后,则程序也随之运行结束。
4.this.setDefaultCloseOperation(3);//EXIT_ON_CLOSE,直接关闭应用程序,System.exit(0)。一个main函数对应一整个程序。
public void setDefaultCloseOperation(int operation):
默认关闭状态:JFrame.class中: private int defaultCloseOperation =HIDE_ON_CLOSE;
因此,默认情况下,关闭窗口,只隐藏界面,不释放占用的内存。
点击窗口右上角关闭,四种关闭方式:
1.this.setDefaultCloseOperation(0);// DO_NOTHING_ON_CLOSE,不执行任何操作。
2.this.setDefaultCloseOperation(1);//HIDE_ON_CLOSE,只隐藏界面,setVisible(false)。
3.this.setDefaultCloseOperation(2);//DISPOSE_ON_CLOSE,隐藏并释放窗体,dispose(),当最后一个窗口被释放后,则程序也随之运行结束。
4.this.setDefaultCloseOperation(3);//EXIT_ON_CLOSE,直接关闭应用程序,System.exit(0)。一个main函数对应一整个程序。
0 0
- setDefaultCloseOperation(int operation)
- setDefaultCloseOperation
- setDefaultCloseOperation
- JFrame 的setDefaultCloseOperation(int) 几个参数的比较
- The method setDefaultCloseOperation(int) is undefined for the type
- setDefaultCloseOperation(3);
- JFrame.setDefaultCloseOperation
- JFrame.setDefaultCloseOperation(…
- 窗口关闭 setDefaultCloseOperation
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JFrame中的setDefaultCloseOperation
- setDefaultCloseOperation相关参数
- Java-Swing-setDefaultCloseOperation函数
- operation
- 窗口关闭setDefaultCloseOperation()的整理
- 窗口关闭setDefaultCloseOperation()的整理
- JFrame中setDefaultCloseOperation的使用方法
- JFrame中setDefaultCloseOperation的参数含义
- Ubuntu及Terminal常用快捷键(转载)
- 个别习惯使用的allegro快捷键
- 开启win7的无线AP功能
- 林口seo优化:如何写出高质量的文章
- 正向代理/反向代理/透明代理
- setDefaultCloseOperation(int operation)
- [leetcode] Permutations
- python 格式化时间字符串
- 用Python让树莓派“说话”
- 版本控制系统概述
- 鼠标悬浮时菜单效果
- 标准库vector类型简介
- mobiscroll 触屏日期插件
- Android中Bitmap, Drawable, Byte,ID之间的转化