JComponent () { GridBagConstraints gbConstraints = new GridBagConstraints(); JPanel panel = new JPanel(new GridBagLayout()); gbConstraints.insets = JBInsets.create(4, 8); gbConstraints.weighty = 0; gbConstraints.weightx = 0; gbConstraints.gridx = 0; gbConstraints.gridy = GridBagConstraints.RELATIVE; gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; panel.add(createDescriptionLabel(), gbConstraints); gbConstraints.weighty = 0; gbConstraints.weightx = 0; gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; String text = myMember instanceof PsiMethod ? RefactoringBundle.message("add.object.as.a.parameter.with.name") : JavaRefactoringBundle.message("add.object.as.a.parameter.to.constructors.with.name"); myMakeClassParameter.setText(text); panel.add(myMakeClassParameter, gbConstraints); myMakeClassParameter.setSelected(myPreferOuterClassParameter); gbConstraints.insets = JBUI.insets(0, 8, 4, 8); gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.gridwidth = 2; gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.anchor = GridBagConstraints.NORTHWEST; if(myNameSuggestions.length > 1) { myClassParameterNameInputField = createComboBoxForName(); } else { JTextField textField = new JTextField(); textField.setText(myNameSuggestions[0]); textField.getDocument().addDocumentListener(new DocumentAdapter() { @Override public void textChanged(@NotNull DocumentEvent event) { updateControls(); } }); myClassParameterNameInputField = textField; } panel.add(myClassParameterNameInputField, gbConstraints); gbConstraints.gridwidth = GridBagConstraints.REMAINDER; if(myVariableData.length > 0) { gbConstraints.insets = JBInsets.create(4, 8); gbConstraints.weighty = 0; gbConstraints.weightx = 0; gbConstraints.gridheight = 1; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; text = myMember instanceof PsiMethod ? JavaRefactoringBundle.message("add.parameters.for.fields") : JavaRefactoringBundle.message("add.parameters.for.fields.to.constructors"); myMakeFieldParameters.setText(text); panel.add(myMakeFieldParameters, gbConstraints); myMakeFieldParameters.setSelected(!myPreferOuterClassParameter); myParameterPanel = new ParameterTablePanel(myProject, myVariableData, myMember) { @Override protected void updateSignature() { } @Override protected void doEnterAction() { clickDefaultButton(); } @Override protected void doCancelAction() { } }; gbConstraints.insets = JBUI.insets(0, 8, 4, 8); gbConstraints.gridwidth = 2; gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weighty = 1; panel.add(myParameterPanel, gbConstraints); } ActionListener inputFieldValidator = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateControls(); } }; myMakeClassParameter.addActionListener(inputFieldValidator); myMakeFieldParameters.addActionListener(inputFieldValidator); if (myMember instanceof PsiMethod) { myGenerateDelegateCb = new JCheckBox(RefactoringBundle.message("delegation.panel.delegate.via.overloading.method")); panel.add(myGenerateDelegateCb, gbConstraints); } updateControls(); return panel; }