JDialog child does not go in the background when Main Window has focus
Main Window creates a non modal JDialog window. Everything works fine untill the Main Window gets the focus. At this point, the JDialog does not go behind the main window but stays in front of the main window. It can be moved out of the way but is there a way so that the main window comes on top when it has focus.
-Sarab
[335 byte] By [
sduhraa] at [2007-11-27 3:23:25]

# 1
If a frame is the owner of child dialogs, then the frame and dialog work together as one. If the frame is iconified, the dialogs are also iconified. When the frame is restored the dialogs are restored. The dialogs will always be on top of the frame.
If you want the dialog to work independently of the frame, then you don't specify the frame as the owner when you create the dialog. The problem with this approach is that when the dialog becomes covered, you have no way to get it back since and icon is not added to the task bar. So you need to use Alt-tab to find it, or minimize windows until you find it again. Not very helpfull. So you could create a dummy frame and use this dialog as the child of the dummy frame. Then you set the size of the size of the dummy frame to (0, 0) so its not visible. Now you have an icon on the task bar to restore the dialog and when you primary frame becomes active it will be painted on top of the dialog.