Initial positioning of Dialog
Scott Palmer
swpalmer at gmail.com
Sat Nov 1 13:25:26 UTC 2014
I was just addressing a bug in my application related to this. The behaviour you describe happens only in Java FX 2.x. In JavaFX 8 the dialog still appears in the centre of the display, but it chooses the correct display based on where the parent window is.
I ended up adding a bit of code to reposition the dialog manually, but it was a little tricky to avoid having the dialog flash at the original position first. I had to set the opacity to 0, reposition it, and then wait a bit before setting the opacity to 1. Even that was done in a couple stages with runLater.
Scott
> On Nov 1, 2014, at 8:03 AM, Pete Moss <peatmoss84 at gmail.com> wrote:
>
> Just getting started using the new openjfx-dialogs. One thing that annoys
> me is the default initial positioning of a popup dialog. The default seems
> to pop up in the center of the primary display screen. This is particularly
> annoying when the app is running in my secondary display. Where's the popup?
>
> Is there an option to have it centered on the stage, or a way to manually
> control the initial position? I tried to handle onShowing() but at this
> point X, Y, width and height are NaN.
>
> Thanks.
More information about the openjfx-dev
mailing list