Solved

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

Posted on 2011-02-16
4
473 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 34911271
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

Assisted Solution

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

Expert Comment

by:CEHJ
ID: 35690428
:)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
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 …

729 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