Home > Archive > Java Help > March 2006 > Updating JTable
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| I created 3 JTables 2X2 each and all the tables are empty,.. Now i want
to update each of the JTable cells. How can i do that.
i created Jtable as follows
JTable Table; // i created 3 table varaibles TableOne, TableTwo,
TableThree
DefaultTableModel model; // i used the same model for all tables
When i created a program with single JTable, i used to update with
following commands
model.insertRow(Integer.parseInt(iterno)-1, new Object[] {iterno ,
host_choice, });
model.removeRow(Integer.parseInt(iterno));
Now i have one 'model' and 3 tables, how can i update all the three
tables with single 'model'. or should i have to create 'model' for each
JTable
Thank you
| |
| Oliver Wong 2006-03-28, 7:04 pm |
|
"Nandu" <nandakishore.v@gmail.com> wrote in message
news:1143413450.665098.19120@u72g2000cwu.googlegroups.com...
>I created 3 JTables 2X2 each and all the tables are empty,.. Now i want
> to update each of the JTable cells. How can i do that.
> i created Jtable as follows
> JTable Table; // i created 3 table varaibles TableOne, TableTwo,
> TableThree
> DefaultTableModel model; // i used the same model for all tables
>
> When i created a program with single JTable, i used to update with
> following commands
>
> model.insertRow(Integer.parseInt(iterno)-1, new Object[] {iterno ,
> host_choice, });
> model.removeRow(Integer.parseInt(iterno));
>
> Now i have one 'model' and 3 tables, how can i update all the three
> tables with single 'model'. or should i have to create 'model' for each
> JTable
If you associate the same model with all 3 tables, whenever you update
the model, the 3 tables should automatically update themselves. If this
doesn't work, perhaps you can post an SSCCE demonstrating the problem. See
http://mindprod.com/jgloss/sscce.html
- Oliver
|
|
|
|
|