private static <T extends Component> T detachParent(@Nullable T component) {
    if (ExperimentalUI.isNewUI() && component != null && component.getParent() != null) {
      component.getParent().remove(component);
    }
    return component;
  }
private static <T extends Component> T detachParent(@Nullable T component)