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?
Asked
Active
Viewed 654 times
1 Answers
-1
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.

AlexR
- 114,158
- 16
- 130
- 208
-
1Do you have any references to show that it really is impossible to get a reference to a native window? even through JNI or JNA? This guy http://stackoverflow.com/questions/4809713/embed-hwnd-window-handle-in-a-jpanel has a handle to a native Windows window. – LarsH Mar 31 '12 at 11:59
-
Obviously JNI allows you to do what you want. But code will not be cross platform. – AlexR Feb 08 '15 at 22:00
-
I think that down voter should at least argue his decision. Downvotin correct answer withot any argument is at least not polite. – AlexR Feb 08 '15 at 22:03
-
1I agree that a down-voter should explain their reasons. I was not the down-voter. – LarsH Feb 09 '15 at 11:28