Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to remove all elements from a JList?

843806Dec 4 2007 — edited Dec 7 2007
Hi,
I'm trying to make a list, and i'd like it to remove all the elements from it from time to time, but i have no idea how to do it. I've read the page about JList, but it didnt contain information about removing all, or selecting all (then remove) or remove a non-selected element.

I'd either need to select all the elements, and then remove them, or if there is another way, i need to remove all the elements, even which are not selected. The problem is, that I couldn't find any parts telling about this at the JList's tutorial page.

Does anyone know a way to do this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 4 2008
Added on Dec 4 2007
9 comments
476 views