• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 488
  • Last Modified:

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.
0
gdkinney_2
Asked:
gdkinney_2
  • 2
  • 2
2 Solutions
 
CEHJCommented:
Try using the following model implementation - you should be able to call Collections.sort on it:

http://technojeeves.com/joomla/index.php/free/76-collectionsnicelistmodel
0
 
objectsCommented:
if its static data then just sort the data before creating your DefaultListModel with the sorted data
0
 
CEHJCommented:
:)
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now