Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What's the best way to center the Dialog

999067Mar 25 2013 — edited Mar 26 2013
Hi,

what is the best way to center a dialog in parent, if dialog was loaded from FXML?

I tried this example:
10441972

but the method setOnShown() is wrong place for method recenter(), it's clearly visible how new dialog at the beginning appears in initial location and after that appears in the center.
And if I try to use recenter() in method setOnShowing() - getWidth() and getHeight() are not available, and I cannot calculate correct central location.

Can somebody help?

Edited by: 996064 on 25.03.2013 15:32
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 23 2013
Added on Mar 25 2013
3 comments
1,616 views