JComponent () { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = JBInsets.create(4, 8); gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.anchor = GridBagConstraints.WEST; if (myClassNameEditable) { gbConstraints.weightx = 0; gbConstraints.gridwidth = 1; panel.add(myInformationLabel, gbConstraints); gbConstraints.insets = JBInsets.create(4, 8); gbConstraints.gridx = 1; gbConstraints.weightx = 1; gbConstraints.gridwidth = 1; gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.anchor = GridBagConstraints.WEST; panel.add(myTfClassName, gbConstraints); myTfClassName.getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(@NotNull DocumentEvent e) { getOKAction().setEnabled(PsiNameHelper.getInstance(myProject).isIdentifier(myTfClassName.getText())); } }); getOKAction().setEnabled(StringUtil.isNotEmpty(myClassName)); } gbConstraints.gridx = 0; gbConstraints.gridy = 2; gbConstraints.weightx = 0; gbConstraints.gridwidth = 1; panel.add(myPackageLabel, gbConstraints); gbConstraints.gridx = 1; gbConstraints.weightx = 1; new AnAction() { @Override public void actionPerformed(@NotNull AnActionEvent e) { myPackageComponent.getButton().doClick(); } }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)), myPackageComponent.getChildComponent()); JPanel _panel = new JPanel(new BorderLayout()); _panel.add(myPackageComponent, BorderLayout.CENTER); panel.add(_panel, gbConstraints); gbConstraints.gridy = 3; gbConstraints.gridx = 0; gbConstraints.gridwidth = 2; gbConstraints.insets.top = 12; gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; final JBLabel label = new JBLabel(RefactoringBundle.message("target.destination.folder")); panel.add(label, gbConstraints); gbConstraints.gridy = 4; gbConstraints.gridx = 0; gbConstraints.fill = GridBagConstraints.HORIZONTAL; gbConstraints.insets.top = 4; panel.add(myDestinationCB, gbConstraints); final boolean isMultipleSourceRoots = JavaProjectRootsUtil.getSuitableDestinationSourceRoots(myProject).size() > 1; myDestinationCB.setVisible(isMultipleSourceRoots); label.setVisible(isMultipleSourceRoots); label.setLabelFor(myDestinationCB); return panel; }