Removing Rows From DefaultTableModel Causes Paint Error
EDIT: Well that was solved quickly. The answer is, instead of removing the rows manually you should use setRowCount(0) instead... Thanks to anyone who started reading this!
I'm making my own task manager with a different functionality. So far I got it so it will get all of the tasks and print it to a JTable. I'm adding rows with DefaultTableModel. My program updates the table every 3 seconds by reloading all the task information, removing all the rows, and adding a whole new set of rows. Most of the time I will not get any error messages, but every so often I the painting methods and row-removal method run into each other and I get a long error message that looks like this:
And I've found by commenting out this bit of my code I get no error messages:
So the problem is obvious, now how do I get around it?
while(tableModel.getRowCount() > 0)