重新实例化 GUI (JFrame) 对象

发布于 2024-08-30 07:06:10 字数 156 浏览 1 评论 0原文

基本上我希望我的 JFrame 在事件触发时成为一个全新的 JFrame 对象。我有一些代码基本上调用 GUI gui = new GUI(x, y) 我遇到的唯一问题是,除了创建新的 GUI 对象外,它并没有删除旧窗口。谁能告诉我如何摆脱旧窗户。

谢谢。

basically I want my JFrame to become a completely new JFrame object when an event is triggered. I have some code that basically calls GUI gui = new GUI(x, y)
the only problem I'm having is that as well as creating the new GUI object, it is not deleting the old window. Can anyone tell me how to get rid of the old window.

Thanks.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我相信您需要致电

I believe you need to call dispose on the existing JFrame first to free it up immediately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文