我在网上找到了一些代码,我编辑了一下。我想隐藏JInternalFrame的标题栏。隐藏JInternalFrame的标题栏? -java
JInternalFrame frame = new JInternalFrame();
// Get the title bar and set it to null
setRootPaneCheckingEnabled(false);
javax.swing.plaf.InternalFrameUI ifu= frame.getUI();
((javax.swing.plaf.basic.BasicInternalFrameUI)ifu).setNorthPane(null);
frame.setLocation(i*50+10, i*50+10);
frame.setSize(200, 150);
//frame.setBackground(Color.white);
frame.setVisible(true);
desktop.add(frame);
问题是标题栏并未因某些原因而被隐藏。 谢谢。
不错,这是正确的答案,不像.setUI(null)!我还在某处看到,在某些事件发生后(如最小化窗口),您可能需要重新执行此操作。 –
这是正确的答案。与'frame.setBorder(null);'结合使用['JInternalFrame'](https://docs.oracle.com/javase/8/docs/api/javax/swing/JInternalFrame.html )作为顶级['JFrame'](http://docs.oracle.com/javase/8/docs/api/javax/swing/JFrame.html)中的独奏组件,就好像它是['JPanel '](http://docs.oracle.com/javase/8/docs/api/javax/swing/JPanel.html)。 – vallismortis
为我工作。我甚至不会尝试,但像魅力一样。谢谢。 – George