Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable

 
Don Lyman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me JTable is still a dog when you have a large number of rows even in Java 2. Does this jive with your experience?
 
Gary Fidler
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you mean a dog when adding many rows to the table. Try this: (sorry I don't have my code example handy)
Instead of adding rows one at a time to the JTable using new Vectors, add new String[] to the underlying data model and then notify the JTable that its data has changed. MUCH faster!
 
Jim McCabe
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think it's the JTable itself but the default table model. Try making your own model. As a test, a couple months ago, I wrote a table model that had 100,000 rows and the JTable didn't slow down at all.
 
Don Lyman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the suggestions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic