JComponent (final Component comp) { if (comp.equals(getFirstComponent())) return getSecondComponent(); if (comp.equals(getSecondComponent())) return getFirstComponent(); LOG.error("invalid component"); return getFirstComponent(); }