Why isn't Java Fullscreen Exclusive Mode running my max screen resolution?

不问归期 提交于 2019-12-24 19:12:20

问题


I am trying to get the Java Fullscreen Exclusive Mode to run at 1080p on my computer, but it only has a size of 1536 x 864. The display mode is also set at 1920 x 1080.

GraphicsDevice device = GraphicsEnvironment
         .getLocalGraphicsEnvironment().getDefaultScreenDevice();
// device.getDisplayMode() returns 1920 x 1080 and some other stats
// device.getDefaultConfiguration().getBounds() returns 1536 x 864

I'm hoping to try to get the screen to be at 1920 x 1080 rather than 1536 x 864. Is there an actual way to do this or is this normal?

Thanks in advance!

Edit: For now, I'm getting this to work on Windows


回答1:


"Why" that mode is chosen, I can't say, but the first thing you will want to do is check the available modes...

DisplayMode modes[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes();
for (DisplayMode mode : modes) {
    System.out.println(mode);
}

So, on my 2017 MacBook Pro, running macOS Maojave (10.14) I get...

2880x1800x32bpp@[Unknown refresh rate]
1440x900x32bpp@[Unknown refresh rate]
3360x2100x32bpp@[Unknown refresh rate]
2560x1600x32bpp@[Unknown refresh rate]
2048x1280x32bpp@[Unknown refresh rate]
1650x1050x32bpp@[Unknown refresh rate]
1280x800x32bpp@[Unknown refresh rate]
1152x720x32bpp@[Unknown refresh rate]
1024x768x32bpp@[Unknown refresh rate]
840x524x32bpp@[Unknown refresh rate]
800x600x32bpp@[Unknown refresh rate]
640x480x32bpp@[Unknown refresh rate]
1680x1050x32bpp@[Unknown refresh rate]

But, as you can see, 1080p isn't supported here :(, so if I was in your shoes, I'd need to find something which was close. Maybe, 1650x1050 or 2048x1280

How does that help you? Well, once you've determined the best mode for your needs, and according to the documentation, you can simply do...

GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
device.setFullScreenWindow(frame);
device.setDisplayMode(mode);


来源:https://stackoverflow.com/questions/55778586/why-isnt-java-fullscreen-exclusive-mode-running-my-max-screen-resolution

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!