jtable!!!!

how to refresh my jtable.

my jtable is connected to the database.

cause when i add data it does not update the jtable.

is there anybody there that can share the code on how to refresh my jtable?

Thanks in advance.

[244 byte] By [lesbona] at [2007-11-27 10:47:24]
# 1

Update the JTable model and then invoke fireTableDataChanged()

OR

Create a new TableModel and use the JTable.setModel(TableModel dataModel) method.

sabre150a at 2007-7-28 20:24:44 > top of Java-index,Java Essentials,Java Programming...
# 2

im a newbie how?

lesbona at 2007-7-28 20:24:44 > top of Java-index,Java Essentials,Java Programming...
# 3

> im a newbie how?

Much depends on your current code and without seeing that I can only generalize.

sabre150a at 2007-7-28 20:24:44 > top of Java-index,Java Essentials,Java Programming...
# 4

exactly as you were told to do it...

The only way to be more clear would be to fly over to whereever you are, sit behind your keyboard, and type it in for you.

Time consuming, expensive, and you won't learn a thing (but it might be an excuse for someone to make a trip somewhere interesting depending on where you live).

jwentinga at 2007-7-28 20:24:44 > top of Java-index,Java Essentials,Java Programming...
# 5

> im a newbie how?

/* pseudo code */

// assume you don't use custom table model class

DefaultTableModel dtm = (DefaultTableModel)table.getModel();

statement.executeUpdate(.....);

// etc., etc. ...

dtm.setDataVector(.....); // update your table model data, wholly

//## if you update only a single existing cell ...

//## dtm.setValueAt(.....);

/* that's all */

hiwaa at 2007-7-28 20:24:44 > top of Java-index,Java Essentials,Java Programming...