Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display selected item in JList

 
Pres Brawner
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a JList that is part of JScrollPane.
I do a search in a database for a value. I then match that value with the value in the JList. I then setSelected on the item in the JList. All this is OK.
However, my JList still displays the first item in the list, not my item. I know the index of the item I want to display. This should be dead-bang easy, but for some reason, I can't think of the solution.
Thanks,
Pres
 
Thomas Suer
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about using the JList's method
?
Tom
[This message has been edited by Thomas Suer (edited November 09, 2001).]
 
Pres Brawner
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That was it!
 
Vinod Venugopal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I faced a similar problem with this setSelectedValue() method when I wanted to select multiple values in a JList automatically, it still selected only once, is there a way ?
Regards,
Vinod
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic