protected final void addImpl(Component comp,Object constraints,int index){
synchronized (getTreeLock()) {
    if (getComponentCount() > 0) {
      remove(0);
    }
    if (index > 0) {
      throw new IllegalArgumentException("position greater than 0");
    }
    if (!SunToolkit.isLightweightOrUnknown(comp)) {
      super.addImpl(comp,constraints,index);
    }
 else {
      addToPanel(comp,constraints,index);
    }
  }
}

protected final void addImpl ( Component comp , Object constraints , int index ) { synchronized ( getTreeLock ( ) ) { if ( getComponentCount ( ) > 0 ) { remove ( 0 ) ; } if ( index > 0 ) { throw new IllegalArgumentException ( "position greater than 0" ) ; } if ( ! SunToolkit . isLightweightOrUnknown ( comp ) ) { super . addImpl ( comp , constraints , index ) ; } else { addToPanel ( comp , constraints , index ) ; } } }
adds the specified component to this scroll pane container . if the scroll pane has an existing child component , that component is removed and the new one is added .
