您将要使用GraphicsEnvironment。
特别是,getScreenDevices()返回GraphicsDevice对象的数组,您可以从中读取显示模式的宽度/高度。
例:
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();GraphicsDevice[] devices = g.getScreenDevices();for (int i = 0; i < devices.length; i++) { System.out.println("Width:" + devices[i].getDisplayMode().getWidth()); System.out.println("Height:" + devices[i].getDisplayMode().getHeight());}


