Help please

I've got a JTable...

the first time this table gets filled everything goes fine... I do this by calling

MyTable = new JTable(rows, col);

rows and col are Vector's.

The rows and col gets filled by data out of a database.... I'll do this like in the next code

while(MyResultSet.next())

{

for(int j = 0; j < cols; k++)//cols is the ColumnCount

{

if(ready ==false)

{

col.addElement(dbb.getTblFinancieelEenmalig().getMetaData().getColumnName(j + 3));

}

if(j == 0)

{

rdata[i] =new Vector();//rdata is a Vector Array where the value of the records,

//per collumn is filled in

}

rdata[i].addElement(dbb.getTblFinancieelEenmalig().getString(j + 3).trim());// I use + 3

//becouse the first 2 columns

//may not been shown

}

ready =true;

rows.addElement(rdata[i]);

i++;

}

}

catch( Exception e )

{

JOptionPane.showMessageDialog(null, e,"Error", JOptionPane.ERROR_MESSAGE);

}

after this the new JTable line is called.

Now I wan't to fill the JTable for a second time but with diferent data.....

But I can't get that done... I've tryed a lot of things but nothing worked....

can somebody tell me how to fill my JTable again using the "rows" and "col"?

I'm using an JScrollPane where I put my JTable on and some scroll bars..

thnx in advance

[2264 byte] By [Follyaxela] at [2007-9-30 2:17:19]
# 1
use TableModel class - getViewport... method of JScrollPane needs to be calledAsk Archita20@hotmail.com - she is java expert and will assist anyone will with any problemGood Luck!!!!!!!!!!!!!!!!!!!!!
rishab_singha at 2007-7-16 13:25:59 > top of Java-index,Archived Forums,Swing...
# 2

> Now I wan't to fill the JTable for a second time but with diferent data

You have two options:

1) Create a new TableModel and use table.setModel(...);

2) Set the current row count to zero in the DefaultTableModel and then insert the new rows. Read the DefaultTableModel API for more information.

camickra at 2007-7-16 13:25:59 > top of Java-index,Archived Forums,Swing...
# 3
thnx....table.setModel() worked... I just had to figure out how it worked.... but it works now...
Follyaxela at 2007-7-16 13:25:59 > top of Java-index,Archived Forums,Swing...