paranoia25
paranoia25

Reputation: 626

Modal dialog not always on top with undecorated frame

I use an undecorated JFrame with a modal dialog. The problem is the modal dialog is always on top when the frame is decorated but nto laways on top when the frame is undecorated. So when I click on my JFrame, the frame is displayed on top and the dialog go underneath.

I use this code.

final JFrame frame = new JFrame();
frame.setUndecorated(true);
frame.setSize(new Dimension(500, 500));
frame.setUndecorated(true);
frame.setVisible(true);
JOptionPane.showInputDialog("OYE");

Upvotes: 0

Views: 807

Answers (2)

Amarnath
Amarnath

Reputation: 8865

JOptionPane.showInputDialog(null, "HelloWorld");

In the above one the parent is null. In your case set parent as your frame.

Example:

JOptionPane.showInputDialog(frame, "HelloWorld");

See showInputDialog for more details.

Upvotes: 4

Related Questions