16.7. Multithreaded Graphics and Double Buffering

One common application of threads is to develop dynamic graphics. Various standard approaches are available, each of which has various advantages and disadvantages.

  • Redraw Everything in paint. This approach is simple and easy, but if things change quickly, drawing everything in paint is slow and can result in a flickering display.

  • Implement the Dynamic Part as a Separate Component. This approach is relatively easy and eliminates the flickering problem but requires a null layout manager and can be quite slow.

  • Have Routines Other Than paint Draw Directly. This approach is easy, efficient, and flicker free but results in “transient” drawing that is lost the next time the screen is redrawn.

  • Override ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.