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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help/suggestions for chat client

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm writing a chat server/client. I'm trying to get the client to have a running list of users. However, the lists in java aren't updateable, and I don't want to use a textarea... anyone got ideas? I'll be much obliged. Thanks.
 
Lists aren't updateable? But they are! You need to use a Model.

DefaultListModel myModel = new DefaultListModel();
JList myList = new JList(myModel);

myModel.addElement(Object o);

myModel.removeElementAt(int index);

That's it.. to add an item, use addElement above. The JList will dynamically update - they're very intimately linked with the Model.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top