Name: mc57594 Date: 06/22/99
if a component is added to more than 1 awt container, it is
silently removed from the previously containing container,
which is indicated by the component's parent instance variable.
This behavior appears to be an undocumented "feature". I looked
at the Javadoc for the addimpl() and add() methods in
java.awt.Container, and saw no mention of the word reparent.
I had to look in the code to find it.
While this behavior may seem obvious, if the side effect were
explicitly documented, then the consequences would be visible
without reading the code.
code fragment from java.awt.Container.addimpl()
/* Reparent the component and tidy up the tree's state. */
if (comp.parent != null) {
comp.parent.remove(comp);
}
(Review ID: 84685)
======================================================================