dcsimg
Multi-threading repaint problem
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Suresh_G
Posted On:   Monday, June 16, 2008 09:25 PM

Hi, Thread 1. I have a swing client with some 20 tabs in JTabbedPane and each tab contains more than 5-6 JTables added in a JPanel. I am repainting the panel for every 500 ms to get the updates and to flash the particular cell.I can't use fireupdatecdell methods... to update the particular cell because I want the flashing effect to be synchronized in all the tables if i have multiple updates in multiple tables.So for every sleep of 500 ms, I am doing panel.repaint().So my flashing effect looks synchronized across the application. Thread 2. I have a Scrolling Ticker which scrolls the latest news, etc.. since thread1 repaints all the panels for every 500 ms and as well as scrolling ticker re   More>>

Hi,

Thread 1.
I have a swing client with some 20 tabs in JTabbedPane and each tab contains more than 5-6 JTables added in a JPanel. I am repainting the panel for every 500 ms to get the updates and to flash the particular cell.I can't use fireupdatecdell methods... to update the particular cell because I want the flashing effect to be synchronized in all the tables if i have multiple updates in multiple tables.So for every sleep of 500 ms, I am doing panel.repaint().So my flashing effect looks synchronized across the application.

Thread 2.
I have a Scrolling Ticker which scrolls the latest news, etc..

since thread1 repaints all the panels for every 500 ms and as well as scrolling ticker repaints(say for every 10 ms) to scroll the message.my scrolling ticker gets stuck and it is not smooth.Since repaint method doesn't required to run in the event-dispatcher thread, I am running both the threads using SwingWorker.

Is there any way to synchronize these 2 painting threads to paint the components to get the smooth scrolling.

Please help.

Thanks,

suresh

   <<Less

Re: Multi-threading repaint problem

Posted By:   Stephen_McConnell  
Posted On:   Tuesday, June 17, 2008 10:27 AM

Figure out how long it would take to repaint all those JPanels. If you are repainting every 500ms (once every 1/2 second) you are going to get jerky scrolling because you are issuing a repaint sometimes before the page finishes repainting.


Stephen McConnell

About | Sitemap | Contact