Hi.

I'm not sure. But when you call add() method you pass reference to the
certain component. If you create new object and assign reference to it, you
just create reference to new object, but old one references to old object.
For example,

// here is new component creation
1. Component c = new Component( .... );
2. add( c );// add to component tree

3. c = new Component( .. );//initialize another component
4. replaceWith( c );// replace old component with new one

if are you asking why sould 4th lines be invoked, the question is simple,
you have to push reference to new component to component tree. If you are
why doesn't it work with out 4th, try to read about references in Java.

Best regards, Alexander.

Reply via email to