Adding elements to a Jlist
I['m trying too add elements from a text file to a Jlist, so I've set up the list with a defaultListModel, and read the objects from the text file into an object array.
Now all I want is one of the variables of the object (title to be precise) to be added to the listmodel, so I use:
for(i=0; i < BookList.length; i++){
bookModel.addElement(BookList.getTitle());
}
where getTitle returns a string value with the title in it. But the addElement command asks for an object parameter, so it compiles ok but when I run I get a nullPointerException.
Is there any way I can do this?
Stu

