我有两个屏幕,主笔记本电脑和第二个显示器。每当我启动此应用程序时,它都会在我的第二个屏幕而不是主屏幕上运行。
我如何告诉应用程序仅在左侧的主屏幕上运行。
例子:
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