JFrame attached on the side of another JFrame

醉酒当歌 提交于 2020-01-04 15:15:11

问题


I'm trying to attach a JFrame to another JFrame, it works by setting the coordinates of the 2nd jframe to the right edge of the first. But it doesn't feel like one whole because when I drag the first JFrame the second one lags behind it like a dog.

Is there any way to keep them from seperating when you drag it, so it looks more like one whole?


回答1:


Because the host's heavyweight peer component owns the frame, this will be difficult to do in a cross-platorm manner. On Mac OS X, you might look at binding to Cocoa Drawers and Disclosure. The MacWidgets project may have useful examples. See also this Q&A.




回答2:


Try a JSplitPane or a JInternalFrame, JInternalFrame provides many features of a native frame.



来源:https://stackoverflow.com/questions/7719572/jframe-attached-on-the-side-of-another-jframe

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