Initial positioning of Dialog

ngalarneau at ABINITIO.COM ngalarneau at ABINITIO.COM
Mon Nov 3 13:44:52 UTC 2014


When you say it works for you, which java are you running?
 - Java 8 (1.8u25) with openjfx-dialogs-1.0.2 like Pete
 - Java 8 update 40 pre-release
 - something else?

Using the released 8u25 with openjfx-dialogs-1.0.2  I, too, have seen the 
dialog pop on the wrong display.


From:   Scott Palmer <swpalmer at>
To:     Pete Moss <peatmoss84 at>, 
Cc:     "openjfx-dev at" <openjfx-dev at>
Date:   11/01/2014 11:00 AM
Subject:        Re: Initial positioning of Dialog
Sent by:        "openjfx-dev" <openjfx-dev-bounces at>

Ah, I the controlsFX code must be doing something to position the dialog. 
Perhaps you can step into the code and see what it is doing.
The behaviour without a owner appears to be the standard behaviour - 
centre on the screen.


> On Nov 1, 2014, at 9:39 AM, Pete Moss <peatmoss84 at> wrote:
> 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 
>     OptionsDlg dlg = new OptionsDlg();   // where OptionsDlg extends 
>     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 
>> On Sat, Nov 1, 2014 at 9:25 AM, Scott Palmer <swpalmer at> 
>> 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> wrote:
>> >
>> > Just getting started using the new openjfx-dialogs. One thing that 
>> > me is the default initial positioning of a popup dialog. The default 
>> > to pop up in the center of the primary display screen. This is 
>> > annoying when the app is running in my secondary display. Where's the 
>> >
>> > Is there an option to have it centered on the stage, or a way to 
>> > control the initial position? I tried to handle onShowing() but at 
>> > point X, Y, width and height are NaN.
>> >
>> > Thanks.

NOTICE from Ab Initio: This email (including any attachments) may contain 
information that is subject to confidentiality obligations or is legally 
privileged, and sender does not waive confidentiality or privilege. If 
received in error, please notify the sender, delete this email, and make 
no further use, disclosure, or distribution. 

More information about the openjfx-dev mailing list