Solved

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

Posted on 2011-02-16
4
430 Views
Last Modified: 2012-05-11
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
Comment
Question by:gdkinney_2
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
Comment Utility
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
 
LVL 92

Expert Comment

by:objects
Comment Utility
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
Comment Utility
if its static data then just sort the data before creating your DefaultListModel with the sorted data
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now