IntelliJ Platform Plugin SDK Help

Combo Box

A combo box combines a drop-down list and an input field, allowing the user to select a value from the list or enter a custom value.

Combo box example

Use ComboBox instead of javax.swing.JComboBox. To make combo box editable invoke:

comboBox.setEditable(true);

When to use

Use a combo box if:

  • The user needs to select a value or enter a custom value.

    Combo box font size
  • The possible choices are objects or states.

  • The user may need to return to previous values. For example, save previously entered paths, so the user can quickly select them later:

    Maven

When not to use

If the number of options is finite, and there’s no need to enter custom values. In this case, use a drop-down list or radio buttons.

If it’s not possible to list the most likely choices. In this case, use an input field instead.

Prefill

If the list is big, and the user knows what value they need and won’t review the list. In this case, use an input field with completion.

Input field completion

How to use

For the label and the default value apply the same rules as for the drop-down list.

If there are no values in the list initially, replace the combo box with an input field. This way, users won't waste their time clicking the empty combo box to find out that there are no options available.

Incorrect

Correct

Combo box empty

Replace with iput field

Replace the input field with a combo box after a value has been entered and confirmed.

Control

Open the combo box menu by clicking the arrow button on the right or pressing the Down arrow key when the combo box is focused. The menu opens down by default. If there is not enough space, the menu opens up.

When the menu opens, select the element that was shown in the closed combo box. If a custom value is entered, then do not select a value in the list.

Move the selection in the menu and update the value in the combo box by pressing the Up and Down arrow keys. On mouse hover, move the selection to an item the cursor is pointing to and update the value by clicking the mouse button or pressing Enter.

The menu remains opened until the user clicks the item in the list, presses Enter or Esc, clicks outside the menu, or switches to another app.

The menu list contains predefined or the most likely options. Follow the rules for drop-down menu items.

If the user needs to return to previous inputs, add such values to the end of the list when clicking the confirmation button in the dialog.

Maven

Use built-in buttons to add values or expand the combo box, e.g., the browse button:

Built in button

Validation

If the user enters an invalid value, highlight the combo box with red and show an error message in a tooltip. For more details, see Validation errors.

Validation

Sizes and placement

Follow the drop-down guidelines.

Last modified: 16 May 2024