aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JList question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList question?" Watch "JList question?" New topic
Author

JList question?

Dominic Steng�rd
Ranch Hand

Joined: Feb 05, 2001
Posts: 186
Hey JavaGuys!

Got a really annoying problem;
Ive got a JList which I want to add strings to. When I add one string everything works fine but when I want to add two or more strings nothing shows up in the JList. The code for adding the strings is:

buddieListModel.addElement(buddieAlias);

Never had this problem with JLists before ... any thoughts are welcome.
Thanks in advance.


Dominic Steng�rd<br />Sun Certified Java 2 Programmer
Matthew Taylor
Rancher

Joined: Jun 13, 2004
Posts: 110
I had some similar problems using Strings in JLists, so I wrote a class that only uses Strings with JLists that extends JList:



I guess I should have commented it, but the method names are self-explanitory. There are methods for adding Strings to the JList that allow repeat values or that don't allow them. This code works, but I don't know how efficiently.
[ October 18, 2004: Message edited by: Matthew Taylor ]

Grails Consultant
http://dangertree.net
 
Don't get me started about those stupid light bulbs.
 
subject: JList question?