Results 1 to 2 of 2
- 01-15-2011, 05:33 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 43
- Rep Power
- 0
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?Java Code:while(tableModel.getRowCount() > 0) tableModel.removeRow(0);
Last edited by MrFish; 01-15-2011 at 05:38 AM.
-
Similar Threads
-
Removing rows from DefaultTableModel
By the reporter in forum AWT / SwingReplies: 4Last Post: 08-01-2010, 04:41 PM -
DefaultTableModel vs AbstractTableModel
By chyrl in forum AWT / SwingReplies: 4Last Post: 05-02-2010, 12:10 PM -
DefaultTableModel get the updated values
By stylian in forum AWT / SwingReplies: 3Last Post: 11-01-2009, 12:26 AM -
DefaultTableModel problem
By stylian in forum AWT / SwingReplies: 2Last Post: 10-31-2009, 04:23 PM -
an error in paint method
By hopey in forum Java 2DReplies: 7Last Post: 04-24-2009, 10:12 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks