void (@NotNull Component childComponent) { Container parent = childComponent.getParent(); if (parent != null) { parent.remove(childComponent); } removeAll(); add(childComponent, BorderLayout.CENTER); revalidate(); }