我可以使用本机系统窗口作为父窗口使 JDialog 成为模式吗?
我有一个 JDialog 窗口。 我需要使其成为模态窗口,但父窗口不是 Java 窗口,而是本机 Windows 操作系统窗口。 是否可以?
I have a JDialog window.
I need to make it modal, but the parent is not Java window, but native Windows OS window.
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,你不能。您甚至无法不仅引用本机窗口,甚至无法引用在其他 JVM 中运行的 java 应用程序创建的窗口。
但是您可以创建虚拟窗口(Window,而不是 Frame 或 JFrame),将其大小设置为 0 并将其用作任何对话框的父窗口。我不知道你的具体问题是什么,但有时我提到的方法可能会有所帮助。
No, you can't. You cannot even achieve reference not only to native windows but even to windows created by java application running in other JVM.
But you can create dummy window (Window, not Frame or JFrame), set its size as 0 and use it as an parent to any dialog. I do not know what is your concrete problem but sometimes the way I mentioned may help.