为什么我的 Swing 应用程序窗口在应用程序退出时间歇性地不关闭?

发布于 2024-07-14 02:56:09 字数 633 浏览 5 评论 0原文

为什么在带有 Sun JDK 6 的 Ubuntu 8.10 上使用 Netbeans 6.5 时,我的 Swing 应用程序没有关闭。甚至从 Netbeans 网站下载的 Netbeans 教程也是如此。 当我关闭应用程序时,我留下了一个死窗口。 然后我必须手动终止该进程。 它来了又去,但我无法弄清楚是什么触发了这种行为。

我还使用 openjdk (6b12-0ubuntu6.1) 和 sun-java (6-10-0ubuntu2) 从命令行终端运行我的应用程序,但仍然没有运气。 我注意到,在尝试关闭它后,通过 netbeans 运行它时,netbeans 仍然显示应用程序正在运行,并且在手动终止进程后,我的 netbeans 日志打印“Java 结果:137”

更新 - 3 月 4 日:我还尝试升级到 Sun JDK 6u12 和网豆 6.7 平方米。 但仍然没有运气。

更新 - 3 月 4 日:好的,经过进一步测试,我发现只要将 JPA 添加到应用程序中,此行为就会开始。 这就解释了为什么 netbeans 网站上的 JPA 教程示例也执行相同的操作。 我尝试编写一个 ExitListener 来首先关闭 EntityManager,但还没有成功。 如果我从表单面板中删除 EntityManager、查询和列表,应用程序将再次正常关闭。

Why are my Swing applications not closing when using Netbeans 6.5 on Ubuntu 8.10 with Sun JDK 6. Even the Netbeans tutorials downloaded from the Netbeans website do the same. When I close the application I'm left with a dead window. I then have to manually kill the process. It comes and goes, but I can't figure out what triggers this behavior.

I have also run my applications from the command line terminal using openjdk (6b12-0ubuntu6.1) and sun-java (6-10-0ubuntu2), still no luck. I have noticed when running it through netbeans after trying to close it netbeans still shows the app as running and after manually killing the process my netbeans log prints "Java Result: 137"

Update - 4Mar: I have also tried upgrading to Sun JDK 6u12 and Netbeans 6.7m2. But still no luck.

Update - 4Mar: Ok, after further testing I found that this behavior starts as soon as I add JPA to my application. That makes explains why the JPA tutorial examples on the netbeans website also do the same. I have tried writing an ExitListener to first close the EntityManager but no luck yet. If I delete the EntityManager, Query and List from my Form Panel the applications closes properly again.

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

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

发布评论

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

评论(3

酒浓于脸红 2024-07-21 02:56:09

确保调用 setDefaultCLoseOperation(JFrame.EXIT_ON_CLOSE);

make sure you call setDefaultCLoseOperation(JFrame.EXIT_ON_CLOSE);

生生漫 2024-07-21 02:56:09

您使用的是 Java 6 的哪个次要版本?
我认为我正在使用更新 10,并且在 Ubuntu 8.10 上遇到了很多问题,升级到 .12 有很大帮助。

What minor release of Java 6 are you using?
I was on update 10 I think and having a lot of issues on Ubuntu 8.10, upgrading to .12 helped a lot.

我爱人 2024-07-21 02:56:09

这是由于使用“系统默认”或“GTKLookAndFeel”外观造成的。 我切换到“NimbusLookAndFeel”,问题就消失了。

我已尝试了所有建议,包括 Netbeans 6.7 和 Java 6.12。

仍然不清楚为什么 Ubuntu 8.10 上会发生这种情况。

This is caused by using the "System Default" or "GTKLookAndFeel" look and feel. I switched over to "NimbusLookAndFeel" and the issue disappeared.

I have tried all suggestions including Netbeans 6.7 and Java 6.12.

Still unclear as to why this is happening on Ubuntu 8.10.

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