我可以使用本机系统窗口作为父级使JDialog成为模态吗? [英] can I make JDialog to be modal using native system window as a parent?
问题描述
我有一个JDialog窗口. 我需要将其设置为模态,但父级不是Java窗口,而是本机Windows OS窗口. 有可能吗?
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?
推荐答案
不,您不能.您甚至无法获得对本机窗口的引用,甚至对在其他JVM中运行的Java应用程序创建的窗口也无法实现引用.
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.
但是您可以创建虚拟窗口(Window,而不是Frame或JFrame),将其大小设置为0并将其用作任何对话框的父窗口.我不知道您的具体问题是什么,但有时我提到的方式可能会有所帮助.
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.
这篇关于我可以使用本机系统窗口作为父级使JDialog成为模态吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!