除了在Java中获取屏幕尺寸外,还可以使用其他方式设置全屏 [英] Setting fullscreen using other ways besides getting screen size in 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"
有关更多详细信息,请参见全屏独占模式.
Have a look at Full-Screen Exclusive Mode for more details.
但是,请理解,它在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应用程序的全屏功能了解更多信息
这篇关于除了在Java中获取屏幕尺寸外,还可以使用其他方式设置全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!