• 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)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic