View Single Post
Old 08-19-2012, 05:15 AM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Its not quite as easy in Java as it is in C# to add to a jlist. If you want to actually add an item to a JList, you need to add it to the list's model. That's a simple matter of retrieving the list model, and casting it:
PHP Code:
((DefaultListModel)mylist.getModel()).addElement(anObject); 
Should do it.
Fou-Lu is offline   Reply With Quote