IdeaGradleProjectSettingsControlBuilder (JPanel content, int indentLevel) { ArrayList<DistributionTypeItem> availableDistributions = new ArrayList<>(); if (!dropUseWrapperButton) availableDistributions.add(new DistributionTypeItem(DistributionType.DEFAULT_WRAPPED)); if (!dropCustomizableWrapperButton) availableDistributions.add(new DistributionTypeItem(DistributionType.WRAPPED)); if (!dropUseLocalDistributionButton) availableDistributions.add(new DistributionTypeItem(DistributionType.LOCAL)); if (!dropUseBundledDistributionButton) availableDistributions.add(new DistributionTypeItem(DistributionType.BUNDLED)); myGradleDistributionComboBox = new ComboBox<>(); myGradleDistributionComboBox.setRenderer(new MyItemCellRenderer<>()); myGradleDistributionHint = new JBLabel(); myGradleHomePathField = new TargetPathFieldWithBrowseButton(); myGradleDistributionHint.setLabelFor(myGradleHomePathField); myGradleHomePathField.getTextField().getDocument().addDocumentListener(new DocumentListener() { @Override public void insertUpdate(DocumentEvent e) { myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor()); } @Override public void removeUpdate(DocumentEvent e) { myGradleHomePathField.getTextField().setForeground(LocationSettingType.EXPLICIT_CORRECT.getColor()); } @Override public void changedUpdate(DocumentEvent e) { } }); myGradleDistributionComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateDistributionComponents(); } }); myGradleDistributionComboBox.setModel(new CollectionComboBoxModel<>(availableDistributions)); if (!availableDistributions.isEmpty()) { content.add(new JBLabel(GradleBundle.message("gradle.project.settings.distribution")), ExternalSystemUiUtil.getLabelConstraints(indentLevel)); content.add(myGradleDistributionComboBox, ExternalSystemUiUtil.getLabelConstraints(0)); JPanel additionalControlsPanel = new JPanel(new GridBagLayout()); additionalControlsPanel.add(myGradleDistributionHint); additionalControlsPanel.add(myGradleHomePathField, ExternalSystemUiUtil.getFillLineConstraints(0)); content.add(additionalControlsPanel, ExternalSystemUiUtil.getFillLineConstraints(0).insets(0, 0, 0, 0)); // adjust the combobox height to match the height of the editor and Gradle GDK combobox. // - without setting the prefered size, it's resized when path component is shown/hidden // - without adjusting the height the combobox is a little smaller then the next combobox (Gradle JVM) boolean macTheme = UIUtil.isUnderDefaultMacTheme(); myGradleDistributionComboBox.setPreferredSize(new Dimension(myGradleDistributionComboBox.getPreferredSize().width, myGradleHomePathField.getPreferredSize().height + (macTheme ? 3 : 0))); } return this; }