void (@Nullable JComponent comp) { BorderLayout layout = (BorderLayout)myAdditionalComponent.getLayout(); Component prev = layout.getLayoutComponent(myAdditionalComponent, BorderLayout.CENTER); if (prev == comp) return; if (prev != null) myAdditionalComponent.remove(prev); if (comp != null) myAdditionalComponent.add(comp, BorderLayout.CENTER); myAdditionalComponent.revalidate(); }