java中关闭的dispose和exit之间的区别 [英] Difference between dispose and exit on close in java
问题描述
我有一个使用Netbeans GUI构建器创建的框架,当我查看框架属性时,第一个选项之一是默认关闭操作,列出的选项是: DISPOSE_ON_CLOSE
, HIDE_ON_CLOSE
, DO_NOTHING_ON_CLOSE
& EXIT_ON_CLOSE
我理解中间两个但是, DISPOSE_ON_CLOSE
和 EXIT_ON_CLOSE $之间的区别是什么c $ c>?我试过测试两个,但对我来说他们对我做同样的事情
I have a single frame created using Netbeans GUI builder when I view the frame properties one of the first options is default close operation the options listed are: DISPOSE_ON_CLOSE
, HIDE_ON_CLOSE
, DO_NOTHING_ON_CLOSE
& EXIT_ON_CLOSE
I understand the middle two but, whats the difference between DISPOSE_ON_CLOSE
and EXIT_ON_CLOSE
? I have tried testing both but to me they do the same thing to me
推荐答案
EXIT_ON_CLOSE
将终止该程序。
DISPOSE_ON_CLOSE
将调用 dispose()
在框架上,这将使它消失并删除它正在使用的资源。与隐藏它不同,你不能把它带回去。
DISPOSE_ON_CLOSE
will call dispose()
on the frame, which will make it disappear and remove the resources it is using. You cannot bring it back, unlike hiding it.
参见aslo JFrame.dispose()vs System.exit()
这篇关于java中关闭的dispose和exit之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!