JTableModel

well,

hope everyone knows that the Abstract table model needs a

rowData [][]

which is a 2D array

now i am converting a result set to this data as follows

int i = 0; //counts the number of rows in the resultset

while(rs.next())

i++;

int datasize = i;

System.out.println(i);

rowData = new Object[datasize][rsmd.getColumnCount()];//rsmd is the ResultSetMetaData

i=0;

rs.beforeFirst();//put cursor at the beginning of the resultset

while(rs.next()) {

j=1;

while(j<=rsmd.getColumnCount()) {

rowData[j-1] = rs.getObject(j); //assign value in the rowData

System.out.println(j);

j++;

}

i++;

}

catch......and so on

I have implemented the other methods such as getValueAt, getRowCount, etc

but when i call this class in the program and

i pass this class ie the implemented abstracttablemodel to the table, it shows the number of columns and rows as well as the names of columns correctly......but then there is no data displayed inside the table cells....

please tell me why it is so?

Is there any other method to implement theabstract table modelso that the resultset that is supppplied to it, will be converted to JTable data....

[1317 byte] By [vaibhavpinglea] at [2007-10-3 8:15:11]
# 1
Use a DefaultTableModel like you where told on the other thread. Stop double posting.
zadoka at 2007-7-15 3:20:11 > top of Java-index,Desktop,Core GUI APIs...
# 2

Don't multi-post.

My response in your last posting said "In The Future".

Anyway you where given an answer so there was no need to repost.

The DefaultTableModel does extend AbstractTableModel. So you copy your ResultSet to the DefaultTableModel.

Take time to understand the suggestion given to you before cluttering the forums with multiple postings.

> hope everyone knows that the Abstract table model needs a rowData [][], which is a 2D array

No it doesn't. An AbstractTableModel does not provide any storage of the data which is why you need to implement all the methods yourself.

camickra at 2007-7-15 3:20:11 > top of Java-index,Desktop,Core GUI APIs...