JComponent () { myNameField = new EditorTextField(""); String qualifiedName = getQualifiedName(); myTfPackage = new PackageNameReferenceEditorCombo(qualifiedName, myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package")); myTfPackage.setTextFieldPreferredWidth(Math.max(qualifiedName.length() + 5, 40)); myPackageLabel.setText(JavaRefactoringBundle.message("destination.package")); myPackageLabel.setLabelFor(myTfPackage); if (myDoClone) { myTfPackage.setVisible(false); myPackageLabel.setVisible(false); } final JLabel label = new JLabel(RefactoringBundle.message("target.destination.folder")); final boolean isMultipleSourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject).size() > 1; myDestinationCB.setVisible(!myDoClone && isMultipleSourceRoots); label.setVisible(!myDoClone && isMultipleSourceRoots); label.setLabelFor(myDestinationCB); final JPanel panel = new JPanel(new BorderLayout()); return FormBuilder.createFormBuilder() .addComponent(myInformationLabel) .addLabeledComponent(RefactoringBundle.message("copy.files.new.name.label"), myNameField, UIUtil.LARGE_VGAP) .addLabeledComponent(myPackageLabel, myTfPackage) .addLabeledComponent(label, myDestinationCB) .addComponent(panel) .getPanel(); }