// 下面程序可以显示所有图形设备的所有分辨率(当然如果只有一个图形设备的的话只显示该设备的所有分辨率,普通机子都只有一个)
package test;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
public class Test {
public static void main(String[] args) {
GraphicsDevice[] devices = GraphicsEnvironment
.getLocalGraphicsEnvironment().getScreenDevices();
for (int i = 0; i < devices.length; i++) {
GraphicsDevice dev = devices[i];
System.out.println("device " + i);
DisplayMode[] modes = dev.getDisplayModes();
for (int j = 0; j < modes.length; j++) {
DisplayMode m = modes[j];
System.out.println(" " + j + ": " + m.getWidth() + " x "
+ m.getHeight());
}
}
}
}