|
Java™ by example!
|
|
|
How do I get the selected item(s) from a JList?
There are several functions to determine the selected value(s) of a JList:
- getSelectedIndex() returns the first selected index
- getSelectedIndices() returns all of the selected indices
- getSelectedValue() returns the first selected value
- getSelectedValues() returns all of the selected values
Here's an example:
Further Information
Author of answer: Joris Van den Bogaert
Comments
Comments to this answer are only viewable by members. Login or become a member!
|
|
|
|
|