ComboBox

Swing component: JComboBox
Swing tutorial: How to Use Combo Boxes

Properties

ComboBox Properties

For border properties see: FlatRoundBorder

Colors

UI Key Style Key v2 Description
ComboBox.foreground foreground text color if enabled
ComboBox.disabledForeground disabledForeground text color if disabled
ComboBox.background background background color if not editable and enabled
ComboBox.editableBackground editableBackground background color if editable and enabled (optional; defaults to ComboBox.background)
ComboBox.disabledBackground disabledBackground background color if disabled
ComboBox.focusedBackground focusedBackground background color if focused (optional)
ComboBox.buttonBackground buttonBackground pull-down button background color (optional; if null, button background is not filled)
ComboBox.buttonEditableBackground buttonEditableBackground pull-down button background color if editable (optional; if null, button background is not filled)
ComboBox.buttonFocusedBackground buttonFocusedBackground pull-down button background color if focused and not editable (optional; defaults to ComboBox.focusedBackground)
ComboBox.buttonSeparatorColor v2 buttonSeparatorColor button separator color if enabled (optional; if null, separator is not painted)
ComboBox.buttonDisabledSeparatorColor v2 buttonDisabledSeparatorColor button separator color if disabled (optional; if null, separator is not painted)
ComboBox.buttonArrowColor buttonArrowColor arrow color of pull-down button if enabled
ComboBox.buttonHoverArrowColor buttonHoverArrowColor arrow color of pull-down button if mouse is over button
ComboBox.buttonPressedArrowColor buttonPressedArrowColor arrow color of pull-down button if mouse is pressed on button
ComboBox.buttonDisabledArrowColor buttonDisabledArrowColor arrow color of pull-down button is disabled
ComboBox.popupBackground popupBackground popup list background color (optional)
ComboBox.selectionForeground - popup list selection text color
ComboBox.selectionBackground - popup list selection background color

Sizes

UI Key Style Key v2 Type Description
ComboBox.buttonSeparatorWidth v2 buttonSeparatorWidth int or float line thickness used to paint the separator (optional; defaults to Component.borderWidth)
ComboBox.padding padding Insets space between the component border and the text
ComboBox.minimumWidth minimumWidth int minimum width of component (in pixels)
ComboBox.editorColumns editorColumns int number of visible columns in text field if combo box is editable
ComboBox.maximumRowCount maximumRowCount int maximum number of visible rows in popup list
ComboBox.popupInsets v3 popupInsets Insets space between popup border and list in popup
ComboBox.selectionInsets v3 selectionInsets Insets space between cell bounds and cell selection in popup list
ComboBox.selectionArc v3 selectionArc int arc diameter of the selection corners in popup list
ComboBox.borderCornerRadius v3.1 - int

popup border corner radius for native borders

Note that this is not available on all platforms since it requires special support. Supported platforms:

  • Windows 11: Only two corner radiuses are supported by the OS. The smaller one is 4px and the larger one 8px. If this value is 1 - 4, then 4px is used. If it is >= 5, then 8px is used.
  • macOS (10.14 and later): Any corner radius is supported. v3.3
ComboBox.roundedBorderWidth v3.3 - int or float

popup border width for native borders

Note that this is not available on all platforms since it requires special support. Supported platforms:

  • macOS (10.14 and later)

Other

UI Key Style Key v2 Type Description
ComboBox.font font Font font used to render text
ComboBox.border border Border usually a FlatRoundBorder
ComboBox.buttonStyle buttonStyle String style of pull-down button: auto (default; depends on editable flag), button (button background and separator shown) or none (no button background and no separator shown)
Component.arrowType arrowType String chevron (default) or triangle