void (final PyTestCustomOption @NotNull ... customOptions) { if (customOptions.length == 0) { return; } final Map<String, JComponent> optionValueFields = new HashMap<>(); for (final PyTestCustomOption option : customOptions) { final JComponent textField = option.isBooleanType() ? new JBCheckBox() : new JBTextField(); optionValueFields.put(option.getName(), textField); } final GridBagConstraints constraints = new GridBagConstraints(); constraints.insets = JBUI.insets(3); constraints.gridy = 0; constraints.anchor = GridBagConstraints.LINE_START; for (final PyTestCustomOption option : customOptions) { final JComponent field = optionValueFields.get(option.getName()); final JLabel label = new JLabel(option.getLocalizedName()); // NON-NLS label.setHorizontalAlignment(SwingConstants.LEFT); constraints.fill = GridBagConstraints.NONE; constraints.gridx = 0; constraints.weightx = 0; myCustomOptionsPanel.add(label, constraints); constraints.gridx = 1; constraints.weightx = 1.0; constraints.fill = GridBagConstraints.HORIZONTAL; myCustomOptionsPanel.add(field, constraints); constraints.gridy++; OptionHolder value = option.isBooleanType() ? new OptionHolder(option, label, (JBCheckBox)field) : new OptionHolder(option, label, (JBTextField)field); myCustomOptions.put(option.getName(), value); } }