问题
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