Hi all,
I've got a little problem with the JDialogs.
Housekeeping: I'm on windows xp, with the latest JRE, I'm getting no error as such.
Basically, I've got some JDialogs in my program (are you sure you wanna close? etc) but they get 'buried' under the main window if you deselect the window (either alt+tab to another prog, or even just clicking in the gray of the start bar). The following code is lifted straight from the main gui window's listeners. It prints out the line when I reselect the program after selecting another. So thoeretically some sort of "optionDialog.s how()" where this prinln is should bring it back on top but it doesnt.
I have tried: optionDialog...
.show()
.setEnabled(tru e)
.setVisible(tru e)
.grabFocus()
.requestFocus()
.doLayout()
.validate()
.revalidate()
none of them bring the JDialog to focus back on top of the main window. It seems like the kind of problem that is fairly obvious with experience in the JDialogs but this is my first real usage of them.
Any ideas?
Thanks all
P.S. I can upload all the code for the program if it would help but would rather not being that it's for my final year project at uni and the plagarism checks they do will google the code right up thus causing me headaches and board meetings!
I've got a little problem with the JDialogs.
Housekeeping: I'm on windows xp, with the latest JRE, I'm getting no error as such.
Basically, I've got some JDialogs in my program (are you sure you wanna close? etc) but they get 'buried' under the main window if you deselect the window (either alt+tab to another prog, or even just clicking in the gray of the start bar). The following code is lifted straight from the main gui window's listeners. It prints out the line when I reselect the program after selecting another. So thoeretically some sort of "optionDialog.s how()" where this prinln is should bring it back on top but it doesnt.
Code:
public void windowActivated(WindowEvent winEvent)
{
if(winEvent.getSource() == this && optionDialog != null)
{
System.out.println("YAY it worked");
}
}
.show()
.setEnabled(tru e)
.setVisible(tru e)
.grabFocus()
.requestFocus()
.doLayout()
.validate()
.revalidate()
none of them bring the JDialog to focus back on top of the main window. It seems like the kind of problem that is fairly obvious with experience in the JDialogs but this is my first real usage of them.
Any ideas?
Thanks all
P.S. I can upload all the code for the program if it would help but would rather not being that it's for my final year project at uni and the plagarism checks they do will google the code right up thus causing me headaches and board meetings!
Comment