我在网上找到了一些代码,稍作修改。我想隐藏一个JInternalFrame的标题栏。
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);
问题在于标题栏由于某种原因没有被隐藏。谢谢。
frame.setBorder(null);
结合使用时,将JInternalFrame
作为顶级JFrame
中的单个组件使用,就像它是一个JPanel
一样有用。 - Parker