显示模式设置: 全屏.displaywidth =(1440,900,16,0)
当前显示分辨率:1440*900 缩放。
代码:
fullscreen.pixelperframe = ((fullscreen.speed - 10) > 1) ? (fullscreen.speed-10) : 1;
DisplayMode dmode = new DisplayMode(fullscreen.displaywidth,fullscreen.displayheight,16,0);
Exception in thread "main" java.lang.IllegalArgumentException: Invalid display mode at sun.awt.CGraphicsDevice.nativeSetDisplayMode(Native Method) at sun.awt.CGraphicsDevice.setDisplayMode(CGraphicsDevice.java:234) at FullScreen.main(FullScreen.java:237)
系统 Macbook Air 2012
我的问题:
适用于 Macbook Air 的正确显示模式设置是什么,或者代码应该不同。
最佳答案
您可以使用GraphicsDevice#getDisplayModes
例如,列出设备可以支持的可用 DisplayMode
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice gd = ge.getDefaultScreenDevice();
for (DisplayMode dm : gd.getDisplayModes()) {
System.out.println(dm.getWidth() + "x" + dm.getHeight() + "@" + dm.getRefreshRate());
}
在 mini-mac 输出上...
2560x1600@32
1280x1024@75
1024x768@75
1024x768@60
800x600@75
800x600@60
640x480@75
640x480@60
1280x1024@60
1600x1200@60
640x480@85
800x600@85
848x480@60
1024x768@85
1280x960@60
1280x960@75
1280x960@85
1280x1024@85
1360x768@60
1920x1080@60
1280x800@32
800x500@32
1024x640@32
1344x1008@32
1344x840@32
1600x1000@32
2048x1280@32
关于java - Swing MacBook 无效显示模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35355466/