Get the content of a JList...

Hi there... Is there a class of method that would return the contents of a JList in an array or vector?Thanks!
[131 byte] By [aows] at [2007-9-26 4:20:50]
# 1
You can use getSelectedValue() to get the content of a JList.Hope it work for you.
TQnguyen at 2007-6-29 17:24:21 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 2

Thanks... I actually wanted to get all the contents of the list, not just the selected ones... I was looking for a direct way of converting the ListModel to a String Array... For now what I did was a for loop to get all elements in the model using getElementAt... It works like this I was just wondering if there was a more direct way....

Thanks again!

aows at 2007-6-29 17:24:21 > top of Java-index,Archived Forums,New To Java Technology Archive...
# 3
Try the getSelectedIndices().It returns an array.
TQnguyen at 2007-6-29 17:24:21 > top of Java-index,Archived Forums,New To Java Technology Archive...