JDesktopPane placement

主宰稳场 提交于 2019-12-13 14:28:17

问题


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?


回答1:


Here's an example that may offer some guidance. It uses setLocation() and an offset.




回答2:


The DesktopManager class is responsible for managing the internal frames.

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.



来源:https://stackoverflow.com/questions/6930158/jdesktoppane-placement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!