Results 1 to 2 of 2
- 01-15-2011, 06:33 AM #1Member
- Join Date
- Jan 2010
- Rep Power
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:
while(tableModel.getRowCount() > 0) tableModel.removeRow(0);
Last edited by MrFish; 01-15-2011 at 06:38 AM.
- By the reporter in forum AWT / SwingReplies: 4Last Post: 08-01-2010, 04:41 PM
- By chyrl in forum AWT / SwingReplies: 4Last Post: 05-02-2010, 12:10 PM
- By stylian in forum AWT / SwingReplies: 3Last Post: 11-01-2009, 01:26 AM
- By stylian in forum AWT / SwingReplies: 2Last Post: 10-31-2009, 05:23 PM
- By hopey in forum Java 2DReplies: 7Last Post: 04-24-2009, 10:12 PM