怎样隐藏窗口标题栏(java)

如题所述

楼主你好

可以用JFrame(或者Frame)类对象的setUndecorated方法来实现

public void setUndecorated(boolean undecorated)
禁用或启用此组件的装饰.

当参数设为true时 就隐藏了窗口标题栏

给lz一个例子:

import javax.swing.*;
public class Test extends JFrame
{
public Test()
{
this.setUndecorated(true);//隐藏标题栏
this.setSize(300,300);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public static void main (String[] args) {
new Test();
}
}

希望能帮助你哈
温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-05-18
用JFrame(Frame)类对象的setUndecorated方法来实现.
组件.setUndecorated(true);
上述这句话就能实现
第2个回答  推荐于2016-05-08
借来的代码,你试试:
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Already there
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setUndecorated(true);
相似回答