views:

16

answers:

1

Hi folks,

How do I obtain the user's edit input on a custom model JTable created from a binary file in order to save it to the binary file?

I suspect that my table model's getValueAt(int, int) method is the problem because it returns data from the binary file before the edit, not the data in the particular cell.

To give you an idea of what this means,

public Object getValueAt(int r, int c) {        
    if (c == 1 ) return data.get(r).getTitle();

The variable data was initialised with an ArrayList drawn from the binary file in a getData method:

List<Data> data = FileOperations.getData();

So I think I have identified the problem: ascertain what the edited cell contains, rather than what was in the ArrayList drawn from the binary file?

I am not sure if I am the only person to have experienced this problem, but it is frustrating.

A: 

You need to implement setValueAt. It will be called each time a cell is modified.

Maurice Perry
Thank you. I'll struggle through somehow :)
Arvanem