This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes stop JTable from repainting during process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "stop JTable from repainting during process" Watch "stop JTable from repainting during process" New topic

stop JTable from repainting during process

Chris Downey

Joined: Jul 23, 2005
Posts: 4
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!

Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
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
I agree. Here's the link:
subject: stop JTable from repainting during process
It's not a secret anymore!