Hi Everyone,
I'm coding a JTable that is capable of handling frequent updates. Typically this JTable has ~1000 rows of data, and some of the columns will update frequently because their values are derived from stock price which moves a lot during market hours.
The problem I'm facing is that when large # of rows (e.g. 80%) are updating, the JTable become very slow for 20-30 seconds or so, which the profiler shows that the EDT thread is extremely busy, handling tableChanged calls.
I try to collapse the changes by 1) suppressing fireTableCellUpdated 2) If there are <= 50 rows changes, call fireTableRowUpdate on individual rows 3) If there > 50 rows of changes, calling fireTableDataChanged for the entire table.
It's better, but still slow when there are frequent updates, my understanding is that fireTableDataChanged is slow as well. So if data updates frequent enough, fireTableDataChanged will be called frequently, and the GUI will feel sluggish.
Can someone experienced in this subject recommend a best practice in using fireTableRowsUpdate, fireTableDataChanged and fireTableStructureChanged to improve GUI liveliness and performance? If you have pointers to sample codes that address this problem it'll be even better.
Many thanks
Anthony Si