I'm doing a lending register inwhich different types of objects (books, cd's and films) are represented. I have a GUI consisting of a AbstractTableModel with an ArrayList in it. The different classes (books etc.) all inherit from a class "Item" I've written. When the objects in the list are shown in teh GUI, I want different pictures to appear in the cells, depending of what kind of objet it is. (the first row of the table should show pictures). The classes all have the method getType, and I've written something like:
PHP Code:
public Object getValueAt(int row, int col){
Item i = ItemsTable.get(row);
switch (col){
case 0: return i.getType();
case 1: return i.getTitle();
case 2: return i.getOriginator();
case 3: return i.getPublicationYear();
case 5: return i.islended();
default: return null;
}
}
I've seen something like a method (i("randomfilename.jpg") ), and i'm trying to use that method, but how do I make it appear in the GUI? i.e what code would do that(in the switch-statement above)?