TableModel

Hello

I'm using a JTable. While the App is running I can add or remove rows from the TableModel. But If I assign a new TableModel to the old, nothing happens. I want that the new Content, the new TableModel rows, are visible immediately.

After I assigned the new TableModel to the old, what I have to do, to see the rows of the new TableModel immediately?

code:

...

JTable table = new JTable(tablemodel);

...

...

tablemodel = another_new_tablemodel;

//now, what I have to do, to show the another_new_tablemodel rows?

Thanks Raphael.

[614 byte] By [rawul] at [2007-9-26 4:00:00]
# 1
try doing this:tablemodel = another_new_tablemodel;tablemodel.fireTableDataChanged(); That would notify the listeners (i.e., the table) that the values in the cells have changed.
vijayreddy at 2007-6-29 12:54:33 > top of Java-index,Archived Forums,Swing...
# 2
What you need to do is this:tablemodel = another_new_tablemode;table.setModel(tablemodel);
chuanhaochiu at 2007-6-29 12:54:33 > top of Java-index,Archived Forums,Swing...