Can someone suggest a way to update that row currently selected in the table
without doing selection updates? I would like to see the data in the table
changed as soon as data in the model has changed.

Many thanks.

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


Hmm, that's odd.  I hate to suggest this... but if moving the selection
updates the data maybe you could do that programmatically.... although it
seems like it should work without having to resort to such trickery....

Yours,

Tom
-----Original Message-----
From: Reinstein, Lenny [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 3:50 PM
To: Tom Copeland; [EMAIL PROTECTED]
Subject: RE: Refreshing the view of JTable.


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
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to