Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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