void (GridBagConstraints gbConstraints, JPanel panel) { final JCheckBox[] removeParamsCb = new JCheckBox[myParametersToRemove.length]; for (int i = 0; i < myParametersToRemove.length; i++) { PsiParameter parameter = myParametersToRemove[i]; if (parameter == null) continue; final NonFocusableCheckBox cb = new NonFocusableCheckBox(JavaRefactoringBundle.message("remove.parameter.0.no.longer.used", parameter.getName())); removeParamsCb[i] = cb; cb.setSelected(true); gbConstraints.gridy++; panel.add(cb, gbConstraints); final int i1 = i; cb.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { myParametersToRemoveChecked[i1] = cb.isSelected(); } }); myParametersToRemoveChecked[i] = true; } updateControls(removeParamsCb); if (myCbReplaceAllOccurences != null) { myCbReplaceAllOccurences.addItemListener( new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { updateControls(removeParamsCb); } } ); } }