I am trying to display a modal dialog before an Applet .
My current solution selects the root frame like this:
Frame getMyParent() { Container parent = getParent(); while (!(parent instanceof Frame)) { parent = ((Component)parent).getParent(); } return (Frame)parent; }
And will create a dialog as follows:
public OptionsDialog(MainApplet applet, boolean modal) { super(applet.getMyParent(), "options", modal);
However, often this shows a modal dialog below the frame, although the modal behavior works correctly.
How can this be fixed?
Ideally, this should be for Java versions 1.5 and higher.
java applet dialog
Nick
source share