Asynchronous painting with JDK 1.4
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alan_Gay
Posted On:   Thursday, September 5, 2002 07:09 AM

When I get a paint event, my paint method does not paint immediately put instead assigns the job to another thread. Thus the painting won't have finished when I return from the call to paint. This seems to cause a problem in JDK 1.4. This is what I'm guessing is going wrong: The implementation of the windows peer (sun.awt.windows.WPanelPeer), in a method replaceSurfaceDataLater, seems to add an event (using the EventQueue.invokeLater method) that attempts to restore the native windows contents using some sort of back buffer. Unfortunately the contents of this back buffer does not get updated correctly because of the asynchronous paint. Thus when you generate an event, say moving the mouse into the window, the incomplete back b   More>>

When I get a paint event, my paint method does not paint immediately put instead assigns the job to another thread. Thus the painting won't have finished when I return from the call to paint.

This seems to cause a problem in JDK 1.4. This is what I'm guessing is going wrong:

The implementation of the windows peer (sun.awt.windows.WPanelPeer), in a method replaceSurfaceDataLater, seems to add an event (using the EventQueue.invokeLater method) that attempts to restore the native windows contents using some sort of back buffer.

Unfortunately the contents of this back buffer does not get updated correctly because of the asynchronous paint. Thus when you generate an event, say moving the mouse into the window, the incomplete back buffer gets drawn to the native window.

Does anyone have any ideas? Thanks in advance!

   <<Less

Re: Asynchronous painting with JDK 1.4

Posted By:   Scott_Rutledge  
Posted On:   Thursday, September 19, 2002 08:24 PM

Hmm, my favourite bug YET again. This is a bug in 1.4 (and 1.4.1, not due to be fixed until 1.4.2). If you're painting from outside the event thread, you must call Toolkit.sync() after all your painting code.
About | Sitemap | Contact