Show a stage on a second and third monitor, wrong order in JavaFX Screen.getScreens()

Davide Perini perini.davide at dpsoftware.org
Sat Jan 9 03:21:45 UTC 2021


Forgive me, it was my fault, JavaFx starts from index 0.

Regards,
Davide

Il 09/01/2021 02:38, Davide Perini ha scritto:
> Hi all,
> I have a triple display setup.
>
> I want to display a stage on the second and third monitor.
> To do this I use the displayNumber variable and this small snippet
>
> for (Screen screen : Screen.getScreens()) {
>     Rectangle2D bounds = screen.getVisualBounds(); if (index == 
> displayNumber) {
>         stage.setX(bounds.getMinX()); stage.setY(bounds.getMinY()); }
>     index++; }
>
> It works quite well since I can choose where the stage is displayed 
> based on the displayNumber variable but
> that number does not corresponds to the Windows order.
>
> In Windows display #2 is the one on my left, in JavaFX it is the one 
> on my right.
>
> Is there a way to get a ordered collections of the displays?
>
> Screen.getScreens()
>
> Thanks
> Davide
>
>
>
>



More information about the openjfx-dev mailing list