Let's assume that I have a class like this:
public Class FooBar {
String foo;
String bar;
String unvisibleField;
String id;
}
Then I have created a table using DefaultTableModel
and adding elements to it like this (I am not showing all attributes of the class to the user):
for(int i=0;i<fooBarList.size();i++){
model.addRow(new String[]{fooBarList.get(i).getFoo(), fooBarList.get(i).getBar()});
}
But I want to retrieve the FooBar class object from the table. Something like this:
model.getRow()
will return a FooBar object
So probably I will also need something like
model.addRow(FooBar item)