JComponent () { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = JBUI.insetsBottom(4); gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.fill = GridBagConstraints.BOTH; myNameLabel = new JLabel(); panel.add(myNameLabel, gbConstraints); gbConstraints.insets = JBUI.insets(0, 0, 4, StringUtil.isEmpty(myNewNamePrefix.getText()) ? 0 : 1); gbConstraints.gridwidth = 1; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.weightx = 0; gbConstraints.gridx = 0; gbConstraints.anchor = GridBagConstraints.WEST; panel.add(myNewNamePrefix, gbConstraints); gbConstraints.insets = JBUI.insetsBottom(8); gbConstraints.gridwidth = 2; gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; gbConstraints.gridx = 0; gbConstraints.weighty = 1; panel.add(myNameSuggestionsField.getComponent(), gbConstraints); createCheckboxes(panel, gbConstraints); JComponent scopePanel = createSearchScopePanel(); if (scopePanel != null) { gbConstraints.insets = JBUI.insetsBottom(8); gbConstraints.gridx = 0; gbConstraints.gridy = GridBagConstraints.RELATIVE; gbConstraints.gridwidth = 2; gbConstraints.fill = GridBagConstraints.BOTH; panel.add(scopePanel, gbConstraints); } return panel; }