JTable - using a 2D vector with AbstractTableModel

D

Deshaies

I have written a 2D vector class; vector of vectors; and would like to
use it with the AbstractTableModel class. I have put an instance of
the 2D vector class into the AbstractTableModel interface and have
removed the static 2D array code.
My problem is that the AbstractTableModel does not recognize the 2D
vector as far as placing data from that vector into the table.

Am I missing something somewhere?

thanks, have a great day, JP
 
T

Thomas Weidenfeller

Deshaies said:
I have written a 2D vector class; vector of vectors; and would like to
use it with the AbstractTableModel class. I have put an instance of
the 2D vector class into the AbstractTableModel interface

AbstractTableModel is a class, not an interface.
and have removed the static 2D array code.

There is no such thing supposed to be removed from AbstractTableModel
when you subclass it. Are you by any chance messing with some other
class, or are you even messing with the source code of AbstractTableModel?
My problem is that the AbstractTableModel does not recognize the 2D
vector as far as placing data from that vector into the table.

Am I missing something somewhere?

We can only guess without seeing your source code. Maybe you messed up
on line 32?

And what about this statement from the API documentation:

<quote>
To create a concrete TableModel as a subclass of AbstractTableModel you
need only provide implementations for the following three methods:

public int getRowCount();
public int getColumnCount();
public Object getValueAt(int row, int column);
</quote>

Did you do that?

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top