Tom,

It works now, except for the row currently selected. This one still remains
unchanged, unless I switch to a different row and then back. Any ideas?

Many thanks. 

-----Original Message-----
From: Tom Copeland [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 11:13 AM
To: [EMAIL PROTECTED]
Cc: Reinstein, Lenny
Subject: RE: Refreshing the view of JTable.


Hi Lenny -

Trying adding a TableModelListener:

===============
      JTable table = new JTable();
      table.getModel().addTableModelListener(new
RepaintingDataListener(table));
===============

that just repaints the table:

===============
public class RepaintingDataListener implements TableModelListener
{
   private JTable mTable;

   public RepaintingDataListener(JTable pTable)
   {
      this.mTable = pTable;
   }
   public void tableChanged(TableModelEvent e) 
   {
      mTable.repaint();
   }
}
===============

Yours,

Tom

-----Original Message-----
From: Reinstein, Lenny [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 10:37 AM
To: '[EMAIL PROTECTED]'
Subject: Refreshing the view of JTable.


I use a simple model that implements AbstractTableModel. I have a
2-dimensional String array that represents the data. When I change the data,
I want the table view to be updated right away. However, it only updates the
view of the current row when I switch to a different row. Calling
revalidate() and updateUI() on the table did not help, as well as calling
fireTableDataChanged() on the model. 

Any ideas?

Thanks.
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to