I'm having trouble with my JOptionPane popping up behind my main window, rather than in front. On the advise of someone more experienced than me, I encased the JOptionPane in a JDialog, as follows:
Object[] array =
{
new JLabel("Enter some text:"), };
JOptionPane pane = new JOptionPane(array,
JOptionPane.ERROR_MESSAGE);
JDialog dialog = pane.createDialog(null, "Result
Data");
dialog.setResizable(true);
dialog.setVisible(true);
dialog.toFront();
and it keeps appearing behind all my windows.
The first time the program runs each session, it pops up behind all the windows, making hte program appear to hang. If I alt-Tab and bring it front, all is fine, and then subsequent iterations of the dialog come up in front
Can anyone help me makes sure these boxes pop up in front every time?
Thanks