• Post Reply Bookmark Topic Watch Topic
  • New Topic

painting problems

 
Anand Rao
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever i iconify and deiconify my Jframe containing a canvas component i lose my previously drawn information on the canvas.
the canvas is erased.
How can i prevent it ?
i tried using buffer.
but when i call repaint() the painting is done on the canvas
but afterwards the frame repaints and i lose my previous painting.
can anyone help me in solving this problem ?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anand,
The only way to avoid the erasing is to override the update method:
public void update( Graphics )
It is the method that gets called by repaint(). It erases the current stuff and then calls paint. If you override it then you can stop the erase from happening and just call paint.
Regards,
Manfred.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!