Solved

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

Posted on 2011-02-16
4
476 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

632 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