除了在 Java 中获取屏幕大小之外,还可以使用其他方式设置全屏
我想知道是否有比使用 Toolkit.getDefaultToolkit().getScreenSize().getHeight()/getWidth();
更好的方法,然后将其用作JFrame,然后将 JFrame 设置为 undecorated
?Java中会不会有某种预先构建的函数来控制显卡以实现真正的全屏?
I was wondering if there was a way that is better than using the Toolkit.getDefaultToolkit().getScreenSize().getHeight()/getWidth();
and then using that as the dimensions for the JFrame and then setting the JFrame to undecorated
? Would there be some sort of pre-built function in Java that takes control of the graphics card for a true fullscreen?
推荐答案
你追求的是所谓的全屏独占模式"
You're after what's called "full-screen exclusive mode"
查看全屏独占模式了解更多详情.
不过请理解,它不能很好地与 Swing 配合使用.
Understand though, it doesn't play well with Swing.
在 Mac OS X 10.7 下,您可以使用 com.apple.eawt.Application.requestToggleFullScreen(Window)
访问它为应用程序提供的全屏支持.
Under Mac OS X 10.7, you can access the full screen support it provides for applications using com.apple.eawt.Application.requestToggleFullScreen(Window)
.
看看 OSX Lion 上 Java 应用程序的全屏功能 更多详情
相关文章