question: public void replace ( Component existingComponent , Component newComponent ) { if ( existingComponent == null || newComponent == null ) { throw new IllegalArgumentException ( "Components must be non-null" ) ; } if ( springsChanged ) { registerComponents ( horizontalGroup , HORIZONTAL ) ; registerComponents ( verticalGroup , VERTICAL ) ; } ComponentInfo info = ( ComponentInfo ) componentInfos . remove ( existingComponent ) ; if ( info == null ) { throw new IllegalArgumentException ( "Component must already exist" ) ; } host . removeComponent ( existingComponent ) ; if ( newComponent . getParent ( ) != host ) { host . addComponent ( newComponent ) ; } info . setComponent ( newComponent ) ; componentInfos . put ( newComponent , info ) ; invalidateHost ( ) ; }
target:  Removes an existing component replacing it with the specified component.