编程论坛's Archiver

ILoveMK 发表于 2007-3-29 22:14

[求助]问个关于jinternalframe的问题

怎么让jinternalframe最大化时没有边框和标题栏,但是右上角有最小化,还原和关闭图标;jinternalframe最小化时收缩在外部容器的左下脚,且只能出现标题栏,标题栏上有最大化,还原和关闭图标(就像photoshop一样),谢谢~~~[em06][em06]

ILoveMK 发表于 2007-3-29 22:39

找个人来帮帮忙吧,不然顶到问题解决为止!!!!!!!!!!!![em05]

ILoveMK 发表于 2007-3-29 23:27

<P>怎么沉啦???顶起来先!!![em05]</P>

ILoveMK 发表于 2007-3-30 07:41

不好意思,问这么简单的问题,结贴结贴。。。[em04]

xiaokelian11 发表于 2008-5-4 21:25

难道没有人能解决吗

xiaokelian11 发表于 2008-5-8 20:38

来看看怎么样了,看来是不好解决了

Sun_NetBeans 发表于 2008-6-19 13:53

最近我也在研究JInternalFrame,期间也遇到过你所提到的问题。今天我把我研究的结果告诉你一下。
(1),要隐藏JInternalFrame的标题栏就用((BasicInternalFrameUI)yourInternalFrame.getUI()).setNorthPane(null);。要隐藏JInternalFrame的边框要用yourInternalFrame.setBorder(BorderFactory.createEmptyBorder());。
(2)要显示标题栏和边框要用yourInternalFrame.updateUI();。
(3),如果你要在最大化的时候去除标题栏和边框就得重载JInternalFrame的setMaximum(boolean b)函数,具体如下:
public void setMaximum(boolean b) throws PropertyVetoException {
        super.setMaximum(b);
         if(b){                 
                ((BasicInternalFrameUI)this.getUI()).setNorthPane(null);
                super.setBorder(BorderFactory.createEmptyBorder());         
          }
}

还有如果你想在JMenuBar中添加控制JInternalFrame的按钮,建议你用一个JLabel放置到JMenuBar的。具体步骤如下:
1.在JLabel上添加一张图片,该图片中有三个图标分别是最小化,最大化,关闭。(该图片可以到Photoshop中去截取)。
2.在你确定已经把所有要用的菜单都添加到JMenubar后就用yourMenubar.add(Box.createHorizontalGlue());来设置yourMenubar的布局
3.将第1步中的Label直接添加到yourMenubar中, yourMenubar.add(yourLabel);

以上为我的研究结果,具体如何用那三个图标控制JInternalFrame就看你自己的实现。

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.