Java Swing 排列 JInternalFrames
Java Swing 中是否有用于排列 JInternalFrame 的默认功能?
我希望在我的 Java Swing 应用程序中具有 Cascade、Tile 等功能,如下所示: http://www.codeproject.com/KB/cs/mdiformstutorial.aspx 我只能找到他们手动安排的代码。 Java Swing 不支持这个还是我有点盲目?
Is there any default functionality for arranging JInternalFrames in Java Swing?
I would like to have the Cascade, Tile, etc... functionality within my Java Swing application like this: http://www.codeproject.com/KB/cs/mdiformstutorial.aspx
I could only find code where they did the arranging manually. Is there no support for this in Java Swing or am I a bit blind?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前做过级联,但我是通过移动帧像素来创建效果的,我不知道另一种方法,我会计算出 JDesktopPane 有多大,然后使用 getAllFrames() 获取内部帧的数组,然后手动执行尺寸调整和移动。
我确信(尽管我已经至少两年没有寻找过)Swing 没有其他方法来执行这些操作,我确信某个地方有人编写了一个第三方库来连接到 Swing 应用程序,如果不是我会写一个并开源它:)
编辑,
只是想你可以做tile等的另一种方式,就是编写一个自定义布局管理器,为你完成繁重的工作,比如FrameTileLayoutManager,然后使用它..它只是一个想法。
I've done cascade before but I did it by shifting the frames pixels to create the affect I do not know another way of doing this, I would work out how big the JDesktopPane is then get an array of you internal frames with getAllFrames(), then perform the sizing and shifting manually.
I am certain (allthough I haven't looked for at least 2 years now) that swing has no other way to perform these operations, I'm sure someone somewhere has a written a third party library to bolt onto swing apps, if not I'd write one and open source it :)
Edit,
Just thought the other way you could do tile etc, would be to write a custom layout manager that did the heavy lifting work for you something like FrameTileLayoutManager, then use that.. its just a thought.
这并不是真正的解决方案,而更像是一种 Hack。如果您可以在渲染框架之前读取桌面窗格的当前宽度,则可以级联/堆叠内部框架。
This is not really a solution but more of a Hack. It is possible to cascade/ stack the internal frames if you can read the current width of the desktop pane before rendering the frame.