157k views
1 vote
The item that is clicked in a JList can be retrieved using the _____ method of JList.

getValue
getSelectedValue
getValueSelected
getData

User Kayess
by
7.3k points

1 Answer

7 votes

Answer:

getSelectedValue

Step-by-step explanation:

The item that is clicked in a JList can be retrieved using the getSelectedValue method of JList.

This returns the first selected value in the list. In case of list supports multi selection, it returns the value with the lowest index. In case nothing is selected in the list, getSelectedValue returns null.

The return type of this method is the same as the datatype of the contents of the list. For example, If the list contains String data , the return type will be String.

User Hemanth
by
6.4k points