Java 全屏模式在 Ubuntu 上不起作用 [英] Java Fullscreen mode not working on Ubuntu

查看:24
本文介绍了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.

我的配置是带有 OpenJDK 或 SUN-JRE 1.7.0_09 以及 Unity 或 Gnome 的 Ubuntu 12.10.有趣的是,对 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.

一些可能的解释可能会在另一个 问题.

Some possible explanations might be given in another question.

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

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