JComponent () { ItemListener itemListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (myCbReplaceAll != null && myAllowInitInMethod) { updateInitializerSelection(); } if (shouldUpdateTypeSelector()) { updateTypeSelector(); } } }; ItemListener finalUpdater = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateCbFinal(); } }; final JComponent initializerPlacePanel = createInitializerPlacePanel(itemListener, finalUpdater); final JPanel checkboxes = appendCheckboxes(itemListener); JPanel panel = composeWholePanel(initializerPlacePanel, checkboxes); updateTypeSelector(); updateCbFinal(); return panel; }