List

Swing component: JList
Swing tutorial: How to Use Lists

Properties

List Properties

Colors

UI Key Style Key v2 Description
List.foreground foreground text color
List.background background background color
List.selectionForeground selectionForeground text color if selected and focused
List.selectionBackground selectionBackground background color if selected and focused
List.selectionInactiveForeground selectionInactiveForeground text color if selected but not focused
List.selectionInactiveBackground selectionInactiveBackground background color if selected but not focused
List.cellFocusColor cellFocusColor cell focus indicator border color
List.dropLineColor - color of line painted between two cells while dragging cells
List.dropCellForeground - text color if cell at mouse location is drop target while dragging cells
List.dropCellBackground - background color if cell at mouse location is drop target while dragging cells

Sizes

UI Key Style Key v2 Type Description
List.cellMargins cellMargins Insets space between cell bounds and cell text
List.selectionInsets v3 selectionInsets Insets space between cell bounds and cell selection
List.selectionArc v3 selectionArc int arc diameter of the selection corners

Other

UI Key Style Key v2 Type Description
List.font font Font font used to render text
List.border border Border usually a FlatEmptyBorder
List.cellRenderer - ListCellRenderer usually a DefaultListCellRenderer
List.showCellFocusIndicator showCellFocusIndicator boolean if true, shows the cell focus indicator border (but only if multiple cells are selected)
List.cellNoFocusBorder - Border cell border if cell is not focused
List.focusCellHighlightBorder - Border cell border if cell is focused but not selected
List.focusSelectedCellHighlightBorder - Border cell border if cell is selected and focused

Styling v2

Following properties are Swing API, but are also available via styling. See JList API for details.

Style Key Type Description Java API
visibleRowCount int number of visible rows; used to calculate preferred size setVisibleRowCount(int)