I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?
我希望我的应用程序具有全屏模式。最简单的方法是什么,我需要第三方库来做这个,还是JDK中已经提供了这个?
5 个解决方案
#1
23
Try the Full-Screen Exclusive Mode API. It was introduced in the JDK in release 1.4. Some of the features include:
尝试全屏独占模式API。它是在JDK 1.4中引入的。其中的一些特点包括:
- Full-Screen Exclusive Mode - allows you to suspend the windowing system so that drawing can be done directly to the screen.
- 全屏排他模式-允许你暂停窗口系统,以便绘图可以直接对屏幕。
- Display Mode - composed of the size (width and height of the monitor, in pixels), bit depth (number of bits per pixel), and refresh rate (how frequently the monitor updates itself).
- 显示模式——由大小(监视器的宽度和高度,以像素为单位)、位深度(每个像素的比特数)和刷新率(监视器更新自己的频率)组成。
- Passive vs. Active Rendering - painting while on the main event loop using the paint method is passive, whereas rendering in your own thread is active.
- 被动渲染和主动渲染——在主事件循环中使用paint方法绘制是被动的,而在自己的线程中绘制是主动的。
- Double Buffering and Page Flipping - Smoother drawing means better perceived performance and a much better user experience.
- 双缓冲和页面翻转-更平滑的绘图意味着更好的感知性能和更好的用户体验。
- BufferStrategy and BufferCapabilities - classes that allow you to draw to surfaces and components without having to know the number of buffers used or the technique used to display them, and help you determine the capabilities of your graphics device.
- 缓冲策略和缓冲能力——允许您在不需要知道使用的缓冲数量或显示缓冲的技术的情况下绘制到表面和组件的类,并帮助您确定图形设备的功能。
There are several full-screen exclusive mode examples in the linked tutorial.
在链接教程中有几个全屏独占模式示例。
#2
2
I've done this using JOGL when having a full screen OpenGL user interface for a game. It's quite easy. I believe that the capability was added to Java with version 5 as well, but it's so long ago that I've forgotten how to do it (edit: see answer above for how).
我在使用JOGL的时候使用了一个完整的OpenGL用户界面来进行游戏。这很容易。我相信这个功能也是在版本5中添加到Java的,但是很久以前我就忘记了怎么做(编辑:参见上面的答案)。
#3
2
JFrame setUndecorated(true)
method
JFrame setUndecorated(真正的)方法
#4
2
Use this code:
使用这段代码:
JFrame frame = new JFrame();
// set properties
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
frame.setUndecorated(true);
frame.setVisible(true);
Make sure setUndecorated()
comes before setVisible()
or it won't work.
确保setun装修()在setVisible()()之前出现,否则它不会工作。
#5
1
It really depends on what you're using to display your interface, i.e. AWT/Spring or OpenGL etc.
这取决于你用什么来显示你的界面,比如AWT/Spring或OpenGL等等。
Java has a full screen exclusive mode API - see this tutorial from Sun.
Java有一个完整的屏幕独占模式API——看这篇来自Sun的教程。
#1
23
Try the Full-Screen Exclusive Mode API. It was introduced in the JDK in release 1.4. Some of the features include:
尝试全屏独占模式API。它是在JDK 1.4中引入的。其中的一些特点包括:
- Full-Screen Exclusive Mode - allows you to suspend the windowing system so that drawing can be done directly to the screen.
- 全屏排他模式-允许你暂停窗口系统,以便绘图可以直接对屏幕。
- Display Mode - composed of the size (width and height of the monitor, in pixels), bit depth (number of bits per pixel), and refresh rate (how frequently the monitor updates itself).
- 显示模式——由大小(监视器的宽度和高度,以像素为单位)、位深度(每个像素的比特数)和刷新率(监视器更新自己的频率)组成。
- Passive vs. Active Rendering - painting while on the main event loop using the paint method is passive, whereas rendering in your own thread is active.
- 被动渲染和主动渲染——在主事件循环中使用paint方法绘制是被动的,而在自己的线程中绘制是主动的。
- Double Buffering and Page Flipping - Smoother drawing means better perceived performance and a much better user experience.
- 双缓冲和页面翻转-更平滑的绘图意味着更好的感知性能和更好的用户体验。
- BufferStrategy and BufferCapabilities - classes that allow you to draw to surfaces and components without having to know the number of buffers used or the technique used to display them, and help you determine the capabilities of your graphics device.
- 缓冲策略和缓冲能力——允许您在不需要知道使用的缓冲数量或显示缓冲的技术的情况下绘制到表面和组件的类,并帮助您确定图形设备的功能。
There are several full-screen exclusive mode examples in the linked tutorial.
在链接教程中有几个全屏独占模式示例。
#2
2
I've done this using JOGL when having a full screen OpenGL user interface for a game. It's quite easy. I believe that the capability was added to Java with version 5 as well, but it's so long ago that I've forgotten how to do it (edit: see answer above for how).
我在使用JOGL的时候使用了一个完整的OpenGL用户界面来进行游戏。这很容易。我相信这个功能也是在版本5中添加到Java的,但是很久以前我就忘记了怎么做(编辑:参见上面的答案)。
#3
2
JFrame setUndecorated(true)
method
JFrame setUndecorated(真正的)方法
#4
2
Use this code:
使用这段代码:
JFrame frame = new JFrame();
// set properties
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
frame.setUndecorated(true);
frame.setVisible(true);
Make sure setUndecorated()
comes before setVisible()
or it won't work.
确保setun装修()在setVisible()()之前出现,否则它不会工作。
#5
1
It really depends on what you're using to display your interface, i.e. AWT/Spring or OpenGL etc.
这取决于你用什么来显示你的界面,比如AWT/Spring或OpenGL等等。
Java has a full screen exclusive mode API - see this tutorial from Sun.
Java有一个完整的屏幕独占模式API——看这篇来自Sun的教程。