Java Reference
In-Depth Information
Table 13-5.
JList Properties (Continued)
Property Name
Data Type
Access
lastVisibleIndex
int
Read-only
layoutOrientation
int
Read-write bound
leadSelectionIndex
int
Read-only
listData
Vector
Write-only
listSelectionListeners
ListSelectionListener[ ]
Read-only
maxSelectionIndex
int
Read-only
minSelectionIndex
int
Read-only
model
ListModel
Read-write bound
preferredScrollableViewportSize
Dimension
Read-only
prototypeCellValue
Object
Read-write bound
scrollableTracksViewportHeight
boolean
Read-only
scrollableTracksViewportWidth
boolean
Read-only
selectedIndex
int
Read-write
selectedIndices
int[ ]
Read-write
selectedValue
Object
Read-only
selectedValues
Object[ ]
Read-only
selectionBackground
Color
Read-write bound
selectionEmpty
boolean
Read-only
selectionForeground
Color
Read-write bound
selectionMode
int
Read-write
selectionModel
ListSelectionModel
Read-write bound
UI
ListUI
Read-write
UIClassID
String
Read-only
valueIsAdjusting
boolean
Read-write
visibleRowCount
int
Read-write bound
Many of the
JList
properties are related to the process of selection. For instance,
anchorSelectionIndex
,
leadSelectionIndex
,
maxSelectionIndex
,
minSelectionIndex
,
selectedIndex
, and
selectedIndices
deal with the indices of the selected rows, while
selectedValue
and
selectedValues
relate to the contents of the selected elements.
The
anchorSelectionIndex
is the most recent
index0
of a
ListDataEvent
, whereas the
leadSelectionIndex
is the most recent
index1
.