I get different behavior. I am using JavaFX 8 (1.8u25) with
openjfx-dialogs-1.0.2 which is part of controlsfx-8.20.8. Here is my show
code:

    OptionsDlg dlg = new OptionsDlg();   // where OptionsDlg extends
Dialog<T>
    dlg.initOwner(mainWnd.getScene().getWindow());
    dlg.showAndWait();

When I set the initOwner() as shown, if the main app is in my primary
display, the dlg seems to be centered on the stage, which I am happy with.
However, if I move my main app into my secondary display, the dlg pops up
in the center of the main display. This seems like a bug.

If I comment out the line that sets initOwner(), the dlg always seems to
pop up in the center of the main display, regardless of where the main app
is.





On Sat, Nov 1, 2014 at 9:25 AM, Scott Palmer <swpal...@gmail.com> wrote:

> 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 <peatmos...@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.
>
>

Reply via email to