Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JList updating

Status
Not open for further replies.

fatcodeguy

Programmer
Feb 25, 2002
281
CA
Hi, this is the first time I use a JList and I'm having a bit of a problem. This is how I instantiate my JList

Vector names = new Vector();
JList namesList = new JList(names);

But when I make changes to the list, such as adding new elements to the vector, or changing names, it doesn't update the list.. how do I do this? Appreciate any help.
Thanks.
 
From my understanding of the Javadocs, a JList does not keep a reference to the data used to create it. A JList just copies the data from the Vector or ListModel to populate itself. To make actual changes to the JList you could update the Vector and then call JList.setListData().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top