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

Davide Perini perini.davide at
Sat Jan 9 01:38:53 UTC 2021

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?



More information about the openjfx-dev mailing list