Component (Component comp) { final int childCount = getComponentCount(); LOG.assertTrue(childCount >= 1); if (childCount > 3) { throw new IllegalStateException(String.valueOf(childCount)); } if (childCount == 1) { setFirstComponent((JComponent)comp); } else { setSecondComponent((JComponent)comp); } return comp; }