jtable not repainting
843805Jul 13 2006 — edited Jul 19 2006I've got the same setup as all the other JTablers out there: a subclassed JTable and a subclassed DefaultTableModel.
The DefaultTableModel's constructor is given a vector of vectors, displayData, to use as the data. It calls super with displayData and a vector of column names.
Every 500ms displayData.clear() is called, followed by a number of displayData.add()s, and then the jtable does a repaint. If I have n rows in the table before I clear displayData, and I have n rows in the table after all the adds are done and before calling repaint, the repaint will be a success and I will see all of the correctly updated values in the table.
If, however, the table has 0 rows before and m rows after where m>0, SOMETIMES what happens when repaint is called is nothing is displayed on the table. And, if that happens, nothing is ever displayed again even with following repaints being issued. The only way I can get those rows to show up is by using my mouse to resize the table, or minimize and maximize it.
I am wondering if there is some method I can invoke which has the same effect as a resize, which causes the table to update correctly. I have tried fireTableDataChanged and fireTableStructureChanged, but I didn't expect these to work anyway since I never created any listeners.
Anyone have a similar experience, and found something that works?
I'll look forward to hearing responses,
Brian