JDesktopPane 放置 [英] JDesktopPane placement

查看:26
本文介绍了JDesktopPane 放置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 JDesktopPane 并且想以网格样式显示 JInternalFrames 而不覆盖框架.框架的尺寸会有所不同,因此应动态分配它们的位置.我可以存储最后放置的框架的坐标,但框架可以移动、最小化或关闭.它们是一种以整洁的方式放置内部框架的简单方法吗?例如,使用布局?

I have a JDesktopPane and want to display JInternalFrames in a grid style without overlaying frames. The dymensions of the frames will vary so their location should be assigned dynamically. I could store the coordinates of the last placed frame but frames can be moved, minimized or closed.. Is their an easy way of placing internal frames in a tidy way? e.g., using a Layout?

推荐答案

DesktopManager 类负责管理内部框架.

The DesktopManager class is responsible for managing the internal frames.

您应该能够覆盖 openFrame() 方法,以便在将框架添加到桌面时对其进行初始定位.

You should be able to override the openFrame() method to initially position the frame when it is added to the desktop.

还有一些拖动方法,您可以覆盖这些方法以防止帧重叠.

There are also methods on dragging that you might be able to override to prevent the overlapping of frames.

这篇关于JDesktopPane 放置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆