private com.codename1.ui.Component copyComponent(com.codename1.ui.Component cmp){
  com.codename1.ui.Container cnt=builder.createContainer(res,copiedResourceName);
  com.codename1.ui.Component dest=builder.findByName(cmp.getName(),cnt);
  if (dest != null && dest.getParent() != null) {
    removeComponentSync(dest.getParent(),dest);
  }
  return dest;
}

private com . codename1 . ui . Component copyComponent ( com . codename1 . ui . Component cmp ) { com . codename1 . ui . Container cnt = builder . createContainer ( res , copiedResourceName ) ; com . codename1 . ui . Component dest = builder . findByName ( cmp . getName ( ) , cnt ) ; if ( dest != null && dest . getParent ( ) != null ) { removeComponentSync ( dest . getParent ( ) , dest ) ; } return dest ; }
creates a copy of the given component and its hierarchy
