Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

stop JTable from repainting during process

 
Chris Downey
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable that is refreshed from a cache when there is a change in the database. The problem I�m facing is that the refresh routine causes the screen to flash and flicker as each item in the table is removed and then refreshed with new data. Is there a way to stop the table from being repainted until the entire refresh is complete?

I'm new to Swing and this is probably a very basic question. Thanks!


Chris
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use a DefaultTableModel for your JTable you have access to the 'newDataAvailable' method in it and several methods in its superclass AbstractTableModel that you can use to do this. At the end of the update you could do something like
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic