我需要开发一个没有标题栏的全屏GUI(我将使用边框布局设计页面start作为我自己的标题(,还需要显示任务栏。我试过这个:
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setUndecorated(true);
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
框架变为全屏,没有标题栏,但隐藏任务栏。
如果我更改为frame.setUndecorated(false);
框架变为全屏并显示任务栏,但标题栏不会消失
我该如何解决这个问题?谢谢。
适用于一个桌面
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);
编辑:也适用于多个桌面!