Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList Refresh

 
Pavan Kumar
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to add item from one Jlist to other Jlist, when I click a add button, the item which is added to Jlist should be visibble. Please let me know how to do coding.

Hari.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
from #1 JList you use getSelectedValue()
add this to #2 JList's listModel

to have this item showing, use this method
list2.ensureIndexIsVisible(listModel.size()-1)
(assuming you want it added to the end of #2)
 
You can thank my dental hygienist for my untimely aliveness. So tiny:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!