本文介绍了如何使 JFrame 真正全屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 Java 应用程序中,我尝试使用以下代码使 JFrame 真正全屏显示:

In my Java application I try to make a JFrame really fullscreen by using this code:

public class MainFrame extends JFrame {

    private static final long serialVersionUID = 1L;

    public MainFrame() {
        super();
        this.setTitle();
        this.setUndecorated(true);

        this.setExtendedState(JFrame.MAXIMIZED_BOTH);

        this.setVisible(true);
        //this.pack();
    }
}

但在我的 Mac 上,我仍然可以看到 Dock 和 OSX 的顶部工具栏.那么如何创建一个真正占用整个屏幕的 JFrame?

But on my Mac I can still see the Dock and the top toolbar of the OSX. So how can I create a JFrame that really consumes my whole screen?

编辑我必须补充一点,我想从 Eclipse 插件中调用该 JFrame.

EDITI have to add that I want to call that JFrame from a eclipse plugin.

推荐答案

我还没试过,但是Java有全屏API,应该可以满足你的需求:

I haven't tried it yet, but Java has fullscreen API, which should meet your needs:

http://docs.oracle.com/javase/tutorial/额外/全屏/index.html

这篇关于如何使 JFrame 真正全屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 15:55
查看更多