In Swing, can a child JComponent
be rendered outside of the bounds of its parent JComponent
, or are children always clipped to the bounds of their parent?
As long as the child is a light-weight component, it will be limited to the boundaries of the parent component. However, if it is too big, It will be cut, no scaling will be done.
If the child is a heavy weight component and the father is light-weight component, the child will be rendered outside of the parent bounds.
There's a really nice article about this here: http://java.sun.com/developer/technicalArticles/GUI/mixing_components/index.html (can't remember who referred me to it but thanks!)
One more update, which I wasn't aware of (in the link):
As of the JDK 6 Update 12 and JDK 7 build 19 releases, it is now possible to seamlessly mix heavyweight and lightweight components within the same container.