- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如果有人能指出我正确的方向。这是我到目前为止的代码。
//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setUndecorated(true);//To remove the bars around the frame.
frame.setResizable(false);//resizability causes unsafe operations.
frame.validate();
//actually applies the fullscreen.
GaphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().setFullScreenWindow(frame);
最佳答案
您可能对 oracle 教程感兴趣的三个复杂示例。
Do you want to use high-performance graphics in the Java development environment? Have you always wanted to program a game, but your images wouldn't move fast enough? Has your slide show program not worked properly because you had no control over the user's display resolution? If you've been asking any of these questions, then the full-screen exclusive mode API, introduced in release 1.4, may be what you're looking for.
CapabilitiesTest demonstrates the different buffering capabilities available for the machine on which it is run.
DisplayModeTest shows a Swing application that uses passive rendering. If full-screen exclusive mode is available, it will enter full-screen exclusive mode. If display mode changes are allowed, it allows you to switch between display modes.
MultiBufferTest enters full-screen mode and uses multi-buffering through an active render loop.
看看这个:
oracle.com/tutorial/fullscreen
还有这个:
oracle.com/tutorial/fullscreen/example
这是一个示例应用程序,可以满足您的需求:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DisplayModeChanger extends JFrame {
private GraphicsDevice device;
private static JButton changeDM = new JButton("800X600 @ 32 BIT 60HZ");
private boolean isFullScreenSupported = false;
public DisplayModeChanger(final GraphicsDevice device) {
this.device = device;
setDefaultCloseOperation(EXIT_ON_CLOSE);
changeDM.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DisplayMode dm = new DisplayMode(800, 600, 32, 60);
device.setDisplayMode(dm);
setSize(new Dimension(dm.getWidth(), dm.getHeight()));
validate();
}
});
}
public void goFullScreen() {
isFullScreenSupported = device.isFullScreenSupported();
setUndecorated(isFullScreenSupported);
setResizable(!isFullScreenSupported);
if (isFullScreenSupported) {
device.setFullScreenWindow(this);
validate();
} else {
pack();
setVisible(true);
}
}
public static void main(String[] args) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice defaultScreen = env.getDefaultScreenDevice();
DisplayModeChanger changer = new DisplayModeChanger(defaultScreen);
changer.getContentPane().add(changeDM);
changer.goFullScreen();
}
}
关于java - 如何在全屏独占模式下设置 Java 应用程序的分辨率/系统分辨率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6115537/
当我在其中一个扬声器上打开独占模式音频流时,会发出奇怪的嗡嗡声。这种嗡嗡声不会在我的其他设备上的相同条件下发生,也不会在一般的独占推送模式或共享模式下发生。 问题似乎是 WASAPI 将周期设置为比我
我的一个类中有一个 double 值,并且有一个上限。 问题是当我尝试将此变量设置为大于其限制的值时。当发生这种情况时,我想将其设置为限制内最接近的值。 当我尝试时,尴尬的情况发生了 .getLimi
我有锁定每个函数(某个库的)的代码,我想对其进行优化。给定函数A和B ,我不介意A与任何其他同时运行 A ,或任何 B与任何其他同时运行 B ,但没有A可以在任何 B 时运行正在运行,反之亦然。线程计
当 XML 必须根据 http://www.w3.org/TR/xml-exc-c14n/ 规范化时,下面的 XML 片段应该相等吗?(注意,. 字符代表一个 ' ' 空格) . ..data .
我想限制对整个应用程序的访问 /*但对于某些 Servlet 则不然。它们应该是公开的。 有没有一种方法可以轻松做到这一点(我想象有一些排除或可能覆盖?)或者我是否必须将文件排列在子文件夹中并允许访问
在一个 spring-mvc 项目中,我对索引/主页的内容进行了测试: @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockM
完全依赖 ARKit 自动平面检测是我不想做的事情,因为它需要时间来检测表面,然后现实生活中的表面应该有足够的纹理,因此我需要考虑一些事情提供一个选项,如果我愿意,我应该能够通过点击按钮随意添加 an
我是一名优秀的程序员,十分优秀!