Java全屏模式无法在Ubuntu上运行 [英] Java Fullscreen mode not working on Ubuntu

查看:199
本文介绍了Java全屏模式无法在Ubuntu上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用Ubuntu,当我想在Java中进入全屏模式时,会出现一个普通窗口,其中包含最大屏幕尺寸,而不是没有标题栏等的全屏窗口。我承认,我甚至不确定是什么全屏模式应该像Java一样,因为我没有在任何其他操作系统上尝试过。但我认为它应该是没有标题栏的屏幕。
有这个问题的其他人吗?

So I'm using Ubuntu and when I want to enter fullscreen mode in Java, a normal window appears with max screen size, instead of a fullscreen window without title bar etc. I admit, I'm not even sure what the fullscreen mode should look like in Java, because I have not tried it on any other OS. But I assume it should be a screen without title bar. Anyone else who has this problem?

这是我使用的代码。 ;非常直接。

This is the code I use. ; pretty straight forward.

public static void main(String[] args) {
    GraphicsEnvironment env = GraphicsEnvironment
            .getLocalGraphicsEnvironment();
    GraphicsDevice vc = env.getDefaultScreenDevice();
    JFrame window = new JFrame();
    window.setUndecorated(false);
    window.setResizable(false);
    vc.setFullScreenWindow(window);
}


推荐答案

在Ubuntu上(可能是其他Linux)发行版也是如此)它不起作用。 Java中的全屏模式不能覆盖全屏。它会丢弃工具栏。总是,无论你做什么。

On Ubuntu (probably other Linux distros as well) it doesn't work. Full screen mode in Java doesn't cover the full screen. It leaves the toolbars out. Always, whatever you do.

我尝试了上面的两个例子和官方FSEM中的例子教程和我知道的一些应用程序正在使用Java / Swing和全屏模式(FreeCol和TripleX),没有人能够完成任务屏幕的/工具栏区域。

I tried the two examples above and the examples from the official FSEM tutorial and some application I know are using Java/Swing and Full screen mode (FreeCol and TripleX) and noone was able to cover the task/toolbar areas of the screen.

我的配置是Ubuntu 12.10,包含OpenJDK或SUN-JRE 1.7.0_09以及Unity或Gnome。有趣的是,对isFullScreenSupported()的java调用返回true。因此,虽然Java JRE表示它支持全屏独占,但它没有。

My configuration is Ubuntu 12.10 with either OpenJDK or SUN-JRE 1.7.0_09 and either Unity or Gnome. Interestingly the java call to isFullScreenSupported() returns true. So, while the Java JRE says it supports full screen exclusive, it doesn't.

可能会在另一个问题

这篇关于Java全屏模式无法在Ubuntu上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆