java中关闭的dispose和exit之间的区别 [英] Difference between dispose and exit on close in java

查看:1033
本文介绍了java中关闭的dispose和exit之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Netbeans GUI构建器创建的框架,当我查看框架属性时,第一个选项之一是默认关闭操作,列出的选项是: DISPOSE_ON_CLOSE HIDE_ON_CLOSE DO_NOTHING_ON_CLOSE & EXIT_ON_CLOSE 我理解中间两个但是, DISPOSE_ON_CLOSE EXIT_ON_CLOSE ?我试过测试两个,但对我来说他们对我做同样的事情

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆