Java 5 - 每次单击时将模态对话框置于前面
设置:Java 5 - 无法升级。
我有一个大型应用程序,有许多模式对话框窗口。我听说隐藏的模式对话框可能会导致不知情的用户甚至重新启动计算机。即使用户知道如何使用 ALT-TAB(至少在 MS Windows 中),这也是一件痛苦的事情。据我了解,这在 Java 的更高版本中得到了部分修复,但不幸的是,这不是一个选项。
那么,如果单击正在运行的应用程序的任何部分,是否有任何方法可以强制显示模式对话框?我想这可能与 MouseListeners、GlassPanes 或其他东西有关。不过,我还有很多其他事情要做,所以我现在没有太多时间来解决这个问题。有人能指出我正确的方向吗?
非常感谢!
Setting: Java 5 - no upgrade possible.
I have a large application that has a number of modal dialog windows. I have heard that hidden modal dialogs can result in uninformed users going so far as to restart their computer. Even if a user knows how to ALT-TAB (in MS Windows, at least), it's a pain. From what I understand, this was in part fixed in later versions of Java, but that's not an option here, unfortunately.
So, is there any way to force a modal dialog to be shown if any part of the running application is clicked on? I was thinking it might have something to do with either MouseListeners, GlassPanes, or something else. However, I've got a bunch of other stuff I'm supposed to be working on, so I don't have a lot of time to devote to hashing this out right now. Can anybody point me in the right direction?
Thanks so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建对话框时,您需要将父框架指定为对话框的所有者。然后,每当您单击框架时,也会显示任何子对话框。
When you create the dialog you need to specify the parent frame as the owner of the dialog. Then whenever you click on the frame any dialog that is a child will also be shown.