如何让JFrame真正全屏? [英] How to make a JFrame really fullscreen?

查看:366
本文介绍了如何让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。

EDIT I 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/extra/fullscreen/index.html

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

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