Get how many monitors are connected.

Davide Perini perini.davide at dpsoftware.org
Sun Sep 5 13:48:28 UTC 2021


I would like to get the same order Windows uses.

Thanks
Davide

Il 03/09/2021 23:51, John Hendrikx ha scritto:
> In what order would you want them?
>
> Windows itself isn't all that reliable either -- it will randomly 
> reorder my screens sometimes when resuming from sleep depending on how 
> quickly all the monitors respond. Currently my primary monitor is 
> screen 2 according to Windows.
>
> Using the bounds you can determine however what is the left/right most 
> screen and which screens go in between.
>
> --John
>
> On 03/09/2021 16:58, Davide Perini wrote:
>> mmm...
>> 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
>> Davide
>>
>>
>> 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