>From what I can tell, you're doing a no-no.

You're using a Swing component to draw on (JPanel).  This is a lightweight 
component and does not follow the same painting paradigm that heavyweight (AWT) 
components do.  Simplified, AWT uses [i]paint(Graphics)[/i] and 
[i]update(Graphics)[/i], while Swing uses the protected 
[i]paintComponent(Graphics)[/i] method.  Stick to 
[i]paintComponent(Graphics)[/i]. ;)

So my preliminary advise would be to change your [i]paint(Graphics)[/i] into 
[i]paintComponent(Graphics)[/i] and to comment out your [i]update(Graphics)[/i] 
method--it doesn't really do anything that [i]paint[/i] hasn't covered.  Make 
sure you do not have any calls to [i]update[/i] or [i]paint[/i] explicitly in 
your code; use [i]repaint()[/i] exclusively.

On an unrelated note, you may want to cache some of your geometry.  At the 
moment, you recreate your grid at each repaint, which can be several times per 
second.  Consider using either a BufferedImage or caching the used Shape.
[Message sent by forum member 'tarbo' (tarbo)]

http://forums.java.net/jive/thread.jspa?messageID=208251

===========================================================================
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