Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Center/Position a showMessageDialog box?

Status
Not open for further replies.

Sweats

Programmer
Nov 15, 2006
6
0
0
US
I am trying to center and/or position a dialog box that by default is popping up right over the button that calls it.
Any help would be much appreciated. Thank you.
 
You need to set the location of the window with method call to setLocation(int x, int y). Otherwise the dialogs (0,0) cordinate will line up with the window it is dependent upon.
 
I figured it out. I did so by replacing the parent component parameter with null. Thanks.
 
I did so by replacing the parent component parameter with null

Hmmm. What behaviour do you get now, with the dialog on-screen, when you maximise another application over yours and then flip back to yours? Does the dialog reappear with your app?

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top