How can I add an Object to a JList? The JList seems only to take a String (or an int).

Rafal Kuczwalski

JList does not provide any methods for adding objects to the list. It has three methods for assigning group of object to the list:

setModel(ListModel model)
setListData(final Object[] listData)
setListData(final Vector listData)

If you want to add objects to the list, you need to make this funcionality by implementing ListModel or AbstractListModel.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact