JComponent (final ItemListener itemListener, final ItemListener finalUpdater) { JPanel groupPanel = new JPanel(new GridBagLayout()); final GridBagConstraints gridBagConstraints = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, JBInsets.emptyInsets(), 0, 0); myInitialisersPlaceModel = new DefaultComboBoxModel<>(); myInitialisersPlaceModel.addElement(BaseExpressionToFieldHandler.InitializationPlace.IN_CURRENT_METHOD); myInitialisersPlaceModel.addElement(BaseExpressionToFieldHandler.InitializationPlace.IN_FIELD_DECLARATION); myInitialisersPlaceModel.addElement(BaseExpressionToFieldHandler.InitializationPlace.IN_CONSTRUCTOR); if (TestFrameworks.getInstance().isTestClass(myParentClass)) { myInitialisersPlaceModel.addElement(BaseExpressionToFieldHandler.InitializationPlace.IN_SETUP_METHOD); } initializeInitializerPlace(myInitializerExpression, IntroduceFieldDialog.ourLastInitializerPlace); if (myInitialisersPlaceModel.getSize() > 1) { final JLabel initLabel = new JLabel(RefactoringBundle.message("initialize.in.border.title") + ":"); gridBagConstraints.insets.left = 5; gridBagConstraints.anchor = GridBagConstraints.WEST; groupPanel.add(initLabel, gridBagConstraints); ComboBox<BaseExpressionToFieldHandler.InitializationPlace> initializersCombo = new ComboBox<>(myInitialisersPlaceModel); KeyboardComboSwitcher.setupActions(initializersCombo, myParentClass.getProject()); initLabel.setLabelFor(initializersCombo); initializersCombo.setRenderer(SimpleListCellRenderer.create("", IntroduceFieldPopupPanel::getPresentableText)); initializersCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { itemListener.itemStateChanged(null); finalUpdater.itemStateChanged(null); } }); gridBagConstraints.gridx = 1; gridBagConstraints.insets.top = 0; gridBagConstraints.insets.left = 0; groupPanel.add(initializersCombo, gridBagConstraints); myInitializerCombo = initializersCombo; } return groupPanel; }