如何在程序停止时阻止 jframe 关闭?

发布于 2025-01-17 16:25:28 字数 242 浏览 2 评论 0原文

我正在使用 jframe 创建一个窗口。但是当程序终止时,窗口将关闭。我希望即使程序关闭时窗口也能保持打开状态。

除了显示文本之外,该窗口没有任何功能。我尝试使用以下方法编辑默认关闭过程:

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

但这并不能阻止程序停止时窗口关闭。 有没有办法即使程序停止时也保持此窗口/jframe 打开?

I am creating a window with a jframe. But when the program terminates the window closes. I want to the window to stay up even when the program closes.

The window doesn't have any functionality apart from displaying from text. I have tried to edit the default close process with:

setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

But this doesn't stop the window from closes when the program stops.
Is there a way to keep this window/jframe open even when the program stops?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文