Setting fullscreen using other ways besides getting screen size in Java(除了在 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 应用程序的全屏功能 更多详情
这篇关于除了在 Java 中获取屏幕大小之外,还可以使用其他方式设置全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:除了在 Java 中获取屏幕大小之外,还可以使用其他方式设置全屏


- 如何指定 CORS 的响应标头? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 获取数字的最后一位 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01