Programmer's Guide > Interfaces > Component interface > replaceChild method
  
replaceChild method
Replaces the child component oldChild with newChild in the list of children, and return the oldChild component.
replaceChild(newChild, oldChild)
Parameters
ComponentnewChild
The new component to put in the child list.
ComponentoldChild
The component being replaced in the child list.
Returns
Component. The component being replaced.
Throws
WindowException
HIERARCHY_REQUEST_ERR: Raised if the component is of a type that does not allow children of the type of the newChild component, or if the component to put in is one of this component's ancestors.
WRONG_WINDOW_ERR: Raised if newChild was created from a different window than the one that created this component.
NOT_FOUND_ERR: Raised if oldChild is not a child of this component.