javaFX错误地报告了屏幕设备的数量
我使用java 8u162和NVidia GPU(及其最新驱动程序)在linux上开发了一个javaFX应用程序,该应用程序位于Red Hat 6.8 x64上,有两个全高清屏幕 检索物理屏幕的数量时遇到问题:javaFX错误地报告了屏幕设备的数量,java,javafx,graphics,x11,nvidia,Java,Javafx,Graphics,X11,Nvidia,我使用java 8u162和NVidia GPU(及其最新驱动程序)在linux上开发了一个javaFX应用程序,该应用程序位于Red Hat 6.8 x64上,有两个全高清屏幕 检索物理屏幕的数量时遇到问题: 当X服务器处于扩展桌面模式时(2个物理屏幕,但是 从0到3840像素的单个逻辑值),Screen.getScreens()返回2 屏幕(正常) 当X服务器处于单独的桌面模式时(2个物理屏幕和 2个逻辑屏幕(从0到1920像素),Screen.getScreens()返回1 Screen
- 当X服务器处于扩展桌面模式时(2个物理屏幕,但是 从0到3840像素的单个逻辑值),Screen.getScreens()返回2 屏幕(正常)
- 当X服务器处于单独的桌面模式时(2个物理屏幕和 2个逻辑屏幕(从0到1920像素),Screen.getScreens()返回1 Screen==>这是正常还是错误
public class ScreenTest extends Application {
private static final int SIZE = 1600;
private final AnchorPane root = new AnchorPane();
@Override
public void start(Stage primaryStage) throws Exception {
root.backgroundProperty().set(new Background(new BackgroundFill(Color.BEIGE, null, null)));
Scene scene = new Scene(root, SIZE, SIZE);
primaryStage.show();
Screen.getScreens().forEach(screen -> System.out.println("JAVAFX :"+ screen));
GraphicsEnvironment env =GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gdev = env.getScreenDevices();
for (GraphicsDevice d : gdev) {
System.out.println("AWT:" + d);
}
}
public static void main(String... strings) {
launch(strings);
}
}
以下是我的xorg.conf X11配置:
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
EndSection
Section "Files"
EndSection
Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "CMN"
HorizSync 53.0 - 66.0
VertRefresh 48.0 - 60.0
Option "DPMS"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Unknown"
ModelName "DELL C7017T"
HorizSync 30.0 - 83.0
VertRefresh 56.0 - 76.0
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K3100M"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "Device1"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Quadro K3100M"
BusID "PCI:1:0:0"
Screen 1
EndSection