I have a swing application, basically, a main frame that could pop up a modal dialog.
When the modal dialog is showing, if I switch to another window, like firefox. And then switch back to the swing application. The JDialog
is not in front any more.
I don't want to set the dialog AlwaysOnTop to be true. because then the dialog will be on top of all windows include windows in other process.
So what should I do so that when I swich back, the modal dialog still on top?
BTW: it is a Applet, so the main frame is actually be set in this way:
private static Frame findParentFrame(Container owner){
Container c = owner;
while(c != null){
if (c instanceof Frame)
return (Frame)c;
c = c.getParent();
}
return (Frame)null;
}
Make sure that the JDialog
is actually modal. Also try setting the main frame as the owner.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With