0

I have made a custom confirmation Dialog in JavaFX. I would like to Center this dialog on the screen, however when I try the following code it does absolutely nothing;

//window is the stage name
window.centerOnScreen();

is there any other method which I can use or am I using this code wrong.

Thanks

Milan
  • 763
  • 3
  • 10
  • 18
  • I usually used Java default toolkit to get screen width and height, then you use it like screen height / 2 - window height / 2 and same for width. Then your window will be positioned right in the center of the screen. Notice that your window is positioned by top left corner. – kolboc Aug 20 '16 at 10:31
  • 1
    Read here: http://stackoverflow.com/questions/29558449/javafx-center-stage-on-screen – PeterMmm Aug 20 '16 at 10:45

0 Answers0