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 中获取屏幕大小之外,还可以使用其他方式设置全屏
基础教程推荐
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
