I need some help with getValue method
Im reading from a file and storing the values in a
public List<Object[]> students;
Now I want to add all of this values to my JTable
@Override
public Object getValueAt(int row, int col) {
//return data[row][col];
// Here I have to get data from students
}
Usually from a lot of example I saw that they use Object[][] data
for doing this kind of thing
this could be something like this
//return data[row][col];
but since I read from a file I want List<Object[]> students;
Any Idea how to implement this in getValueAt method?
my solution will be this
@Override
public Object getValueAt(int row, int col) {
//return data[row][col];
for(Object[] j: students)
{
return j[col];
}
return null;
}
but this will only take the first object and will assign to all rows in my JTable
how about:
@Override
public Object getValueAt(int row, int col) {
return students.get(row)[col];
}