Java Reference
In-Depth Information
selections were allowed in this program, the
getSelectedValue
method returns
the first item selected, so that would be the image displayed. A similar method
called
getSelectedValues
returns an array of objects representing the items
selected when multiple selections are permitted.
Instead of an array of
String
objects, the
JList
constructor could be passed
an array of
ImageIcon
objects instead. In that case, the images would be displayed
in the list.
SELF-REVIEW QUESTIONS
(see answers in Appendix N)
SR 11.29
Describe the use of the divider bar on a split pane.
SR 11.30
What is the difference between how a combo box (Section 11.8) is
displayed and how a
JList
object is displayed?
Search WWH ::
Custom Search