Discussion:
Any easy way to show a JList in reverse order?
(too old to reply)
Mungo Henning
2006-11-04 11:45:40 UTC
Permalink
Hi Folks,
Beg pardon the "stoopid" question, but is there any easy way to "reverse"
the displayed
order of items in a JList?
I've got a JList that gets its data from a DefaultListModel and the first
item shown on the screen
appears at the top. Additional items grow down the screen; I'd like them to
grow up.

Sounds kindof an easy change to make, but Google hasn't helped me hence I
throw myself
on the mercy and kindness of the group.
Thanks in advance

Mungo Henning
Martin Weiss
2006-11-04 12:52:00 UTC
Permalink
Post by Mungo Henning
Hi Folks,
Beg pardon the "stoopid" question, but is there any easy way to "reverse"
the displayed
order of items in a JList?
I've got a JList that gets its data from a DefaultListModel and the first
item shown on the screen
appears at the top. Additional items grow down the screen; I'd like them to
grow up.
Sounds kindof an easy change to make, but Google hasn't helped me hence I
throw myself
on the mercy and kindness of the group.
Thanks in advance
Mungo Henning
I never used a JList, but quick look at the API and some Sun Tutorials
lead me here:
http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#mutable

the method insertElementAt() looks like it could help you :-)
Mungo Henning
2006-11-04 13:06:51 UTC
Permalink
Hi Martin,
Damn.. its obvious. Thanks for the help.
I had discounted the "add" method because I guessed that
it would overwrite any value presently at that location.
I'm learning...

Thanks again Martin

Mungo
Post by Martin Weiss
http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#mutable
the method insertElementAt() looks like it could help you :-)
Loading...