JComponent () { final JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0, 1, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBInsets.emptyInsets(), 0, 0); myNamePanel = new JPanel(new BorderLayout(0, 2)); myNameField = new EditorTextField(myMethod.getName()); final JLabel nameLabel = new JLabel(RefactoringBundle.message("changeSignature.name.prompt")); nameLabel.setLabelFor(myNameField); myNameField.setEnabled(myMethod.canChangeName()); if (myMethod.canChangeName()) { myNameField.addDocumentListener(mySignatureUpdater); Disposer.register(myDisposable, () -> myNameField.removeDocumentListener(mySignatureUpdater)); myNameField.setPreferredWidth(200); } myNamePanel.add(nameLabel, BorderLayout.NORTH); myNamePanel.add(myNameField, BorderLayout.SOUTH); JPanel visibilityPanel = createVisibilityPanel(); if (myMethod.canChangeVisibility() && myVisibilityPanel instanceof ComboBoxVisibilityPanel) { ((ComboBoxVisibilityPanel<?>)myVisibilityPanel).registerUpDownActionsFor(myNameField); visibilityPanel.setBorder(JBUI.Borders.emptyRight(8)); panel.add(visibilityPanel, gbc); gbc.gridx++; } gbc.weightx = 1; if (myMethod.canChangeReturnType() != MethodDescriptor.ReadWriteOption.None) { JPanel typePanel = new JPanel(new BorderLayout(0, 2)); typePanel.setBorder(JBUI.Borders.emptyRight(8)); final JLabel typeLabel = new JLabel(RefactoringBundle.message("changeSignature.return.type.prompt")); myReturnTypeCodeFragment = createReturnTypeCodeFragment(); final Document document = PsiDocumentManager.getInstance(myProject).getDocument(myReturnTypeCodeFragment); myReturnTypeField = createReturnTypeTextField(document); ((ComboBoxVisibilityPanel<?>)myVisibilityPanel).registerUpDownActionsFor(myReturnTypeField); typeLabel.setLabelFor(myReturnTypeField); if (myMethod.canChangeReturnType() == MethodDescriptor.ReadWriteOption.ReadWrite) { myReturnTypeField.setPreferredWidth(200); myReturnTypeField.addDocumentListener(mySignatureUpdater); Disposer.register(myDisposable, () -> myReturnTypeField.removeDocumentListener(mySignatureUpdater)); } else { myReturnTypeField.setEnabled(false); } typePanel.add(typeLabel, BorderLayout.NORTH); typePanel.add(myReturnTypeField, BorderLayout.SOUTH); if (placeReturnTypeBeforeName()) { panel.add(typePanel, gbc); gbc.gridx++; panel.add(myNamePanel, gbc); } else { panel.add(myNamePanel, gbc); gbc.gridx++; panel.add(typePanel, gbc); } } else { panel.add(myNamePanel, gbc); } return panel; }