Here's another approach.  Try modifying your app so that instead of
rendering all the primitives to the graphics context in paintComponent,
you instead render them to an off-screen image (BufferedImage)
whenever your layout model changes.  Then paintComponent only has to
redraw from the backing image instead of redrawing all affected
primitives.  This by itself doesn't get you much, and is actually
duplicating Swing's double buffering (which you should turn off).
The trick is to decouple any moving objects and draw them separately
in paintComponent, on top of the backing image.  Temporarily disable
the moving objects in the main display list and re-render the backing
image without them.  Then they're free to be redrawn on each update
and they'll essentially float on top of the backing image without
requiring it to be regenerated each time.  You'll only have to update
the image when the moving objects are checked in or out of the list.

---------------------------------------------------------------------
Kevin Weiner    FM Software    610-997-3930    http://www.fmsware.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to