This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JList question?

 
Dominic Steng�rd
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matthew Taylor
Rancher
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic