hiding title bar of JInternalFrame? -java(隐藏 JInternalFrame 的标题栏?-java)
问题描述
我在网上找到了一些代码,我编辑了一下.我想隐藏 JInternalFrame 的标题栏.
I found some code online, I edited it a bit. I want to hide title bar of a 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);
问题是标题栏由于某种原因没有被隐藏.谢谢.
The problem is that the title bar isn't being hidden for some reason. Thanks.
推荐答案
我这样解决了这个问题:我继承了 JInternalFrame 并将以下代码添加到它的构造函数中.(我免费获得子类化,因为我使用 netBeans 的 GUI Builder)
I solved this problem this way: I subclass JInternalFrame and add the following code to its constructor. (I get the subclassing for free because I use netBeans' GUI Builder)
((javax.swing.plaf.basic.BasicInternalFrameUI)this.getUI()).setNorthPane(null);
我认为你的情况
这篇关于隐藏 JInternalFrame 的标题栏?-java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:隐藏 JInternalFrame 的标题栏?-java


基础教程推荐
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01