2
我有兩個屏幕,主要筆記本電腦和第二臺顯示器。無論何時啓動此應用程序,它都會在我的第二個屏幕上運行,而不是主屏幕。Java - 如何設置我的應用程序總是在主屏幕上運行,但不在第二個屏幕上運行?
我該如何告訴應用程序只能在左側的主屏幕上運行。
例子:
screen = Toolkit.getDefaultToolkit().getScreenSize();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] screenDevices = ge.getScreenDevices();
for (int i = 0; i < screenDevices.length; i++) {
System.out.println(screenDevices[i].getIDstring());
DisplayMode dm = screenDevices[i].getDisplayMode();
int screenWidth = dm.getWidth();
int screenHeight = dm.getHeight();
System.out.println("[myResolution]: " + screenWidth + " " + screenHeight);
screen.width = screenWidth;
screen.height = screenHeight;
}
Output:
0.0
1024x768
0.1
1024x768