JList

JList allows the user to select one or more objects from a list. The easiest way to create a JList is by supplying its constructor with an array of String objects. A more powerful (and complex) option is to create a separate ListModel object to represent the contents of the list.

JList doesn't support scrolling directly. To create a scrolling list you make the JList the viewport view of a JScrollPane.

By default, JList supports single selection. The selection state is actually managed by a separate delegate object (an implementation of the ListSelectionModel interface). However, the default functionality demonstrated in the example is generally sufficient.

JList generates ListSelectionEvents. These objects contain "row selection interval" information only. To identify more useful information (like the selected String):

JList doesn't provide any special support for handling double or triple mouse clicks; however, it's easy to handle them by creating your own MouseListener.

[Reference: Topley, pp591-611]