Java 显示带任务栏的全屏 Swing 应用程序,没有标题栏 [英] Java show fullscreen swing application with taskbar without titlebar

查看:66
本文介绍了Java 显示带任务栏的全屏 Swing 应用程序,没有标题栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要开发一个没有标题栏的全屏GUI(我将使用边框布局设计页面开始作为我自己的标题),还需要显示任务栏.我试过这个:

I need to develop a full-screen GUI without a title bar on it (I am going to use border layout design page start as my own title), also need to show the taskbar. I have tried this:

JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
frame.setUndecorated(true);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);

框架变为全屏,没有标题栏但隐藏任务栏.

Frame becomes full-screen without the title bar but hides the taskbar.

如果我更改为 frame.setUndecorated(false);框架变为全屏并显示任务栏,但标题栏没有消失

if I change to frame.setUndecorated(false); the frame becomes full-screen and taskbar is shown, but title bar doesn't disappear

我该如何解决?谢谢你.

How can I fix that? Thank you.

推荐答案

适用于一个桌面

    Rectangle r = GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds();
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    frame.setUndecorated(true);
    frame.setSize(r.width, r.height);
    frame.setVisible(true);

这篇关于Java 显示带任务栏的全屏 Swing 应用程序,没有标题栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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