Need to sort the items in a JList according to their name in ascending order

I am using a JList and I have a list of items that need to be sorted in increasing order by their name.  Any ideas on how to do this?  Currently I am using a DefaultListModel as my model for the JLists.
Who is Participating?
CEHJConnect With a Mentor Commented:
Try using the following model implementation - you should be able to call Collections.sort on it:
objectsConnect With a Mentor Commented:
if its static data then just sort the data before creating your DefaultListModel with the sorted data
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.