Get how many monitors are connected.

Davide Perini perini.davide at
Fri Sep 3 14:58:44 UTC 2021

I confirm that it isn't really reliable.

I have noticed the Screen.getScreens() have primary screen as the first 
element, but other screens are just in a non correct order.

Hope that JavaFX will find a way to overcome this problem.

Thank you

Il 03/09/2021 16:39, Kevin Rushforth ha scritto:
> I don't think so. You can find out the primary monitor with 
> Screen.getPrimary(), and you can determine the positioning of all 
> screens relative to each other using the visual bounds of each screen. 
> There isn't any guarantee, though, that the list of screens is 
> ordered, so if there are more than 2 screens, I don't know of a 
> reliable way to distinguish the second, third, and so on.
> -- Kevin
> On 9/3/2021 7:06 AM, Davide Perini wrote:
>> Hi,
>> I'm using this to get how many monitors is connected to the PC:
>> for (Screen screen : Screen.getScreens()) {
>> }
>> Is there a way to know what is the first, second and third monitor?
>> Using Windows and I would like to see what is the first monitor set 
>> in windows, what's the second and so on.
>> Is this possible using JavaFX?
>> Thanks
>> Davide

More information about the openjfx-dev mailing list