Skip to content

Commit 534ef3e

Browse files
committed
Fixed subsequent StartupDialogs
1 parent aec7e12 commit 534ef3e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

visualvm/startup/src/org/graalvm/visualvm/modules/startup/dialogs/StartupDialog.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,16 @@ public final class StartupDialog {
5656

5757
public static JDialog create(String caption, String message, int messageType) {
5858
// Bugfix #361, set the JDialog to appear in the Taskbar on Windows (ModalityType.APPLICATION_MODAL)
59-
Window[] windows = Window.getWindows();
60-
final JDialog d = windows == null || windows.length == 0 ?
59+
Window parent = null;
60+
for (Window window : Window.getWindows()) {
61+
if (window.isVisible() && window.isShowing()) {
62+
parent = window;
63+
break;
64+
}
65+
}
66+
final JDialog d = parent == null ?
6167
new JDialog(null, caption, JDialog.ModalityType.APPLICATION_MODAL) :
62-
new JDialog((Frame)null, caption, true);
68+
new JDialog((Frame)null, caption, true); // NOTE: should a (Frame)parent be used here?
6369

6470
if (message != null) initDialog(d, message, messageType);
6571

0 commit comments

Comments
 (0)