Получить разрешение экрана нескольких дисплеев - PullRequest
0 голосов
/ 09 июня 2018

Я пытаюсь получить разрешение экрана монитора с помощью Java.Проблема в том, что я не получаю правильный вывод.Первый из трех мониторов показан с шириной 5760 пикселей вместо 1920. Все они имеют одинаковый размер 1920x1080.

Код:

GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gs = ge.getScreenDevices();
System.out.println("Number of devices: " + gs.length);
System.out.println("Default resolution: " + java.awt.Toolkit.getDefaultToolkit().getScreenSize());
for (int i = 0; i < gs.length; i++) {
    System.out.printf("id: %s, width: %d, height: %d\r\n", gs[i].getIDstring(), gs[i].getDisplayMode().getWidth(), gs[i].getDisplayMode().getHeight());
}

Вывод:

Number of devices: 3
Default resolution: java.awt.Dimension[width=5760,height=1080]
id: :0.0, width: 5760, height: 1080
id: :0.1, width: 1920, height: 1080
id: :0.2, width: 1920, height: 1080

Любой намек на то, как получить все три правильных размера монитора?

РЕДАКТИРОВАТЬ 1:

Вывод xrandr:

myuser@mysystem ~ $ xrandr 
Screen 0: minimum 8 x 8, current 5760 x 1080, maximum 32767 x 32767
DVI-D-0 disconnected (normal left inverted right x axis y axis)
HDMI-0 connected 1920x1080+3840+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+  59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+  59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
HDMI-2 connected primary 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
   1920x1080     60.00*+  59.94    50.00    60.05    60.00    50.04  
   1680x1050     59.95  
   1440x900      59.89  
   1280x1024     75.02    60.02  
   1280x960      60.00  
   1280x800      59.81  
   1280x720      60.00    59.94    50.00  
   1152x864      75.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93 
...