Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changing Jlist  RSS feed

 
Nathan Newton
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm after some help, I want to have a jlist starting off empty, and whilst running the program update and change the contents of the jlist. Any help with this would be very much appreciated.

Thanks
 
Campbell Ritchie
Sheriff
Posts: 53749
127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch
Haven't used a JList for a bit, so I think I would do best to direct you to the Java Tutorials. That has a section about adding items to a JList.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a JList with an empty DefaultListModel()
then add/remove/whatever to the model
 
Nathan Newton
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Dunn:
create a JList with an empty DefaultListModel()
then add/remove/whatever to the model


Thanks very much that perfect for the job.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!