• Post Reply Bookmark Topic Watch Topic
  • New Topic

Maximizing + Restoring Image on Canvas * SOLVED *  RSS feed

 
Dan Grieve
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all, I've written a small program that allows the user to add points to a canvas, and the program creates a polygon. That all works fine and dandy.

The problem I'm coming to is if the user minimizes the program, then maxmimizes it again the canvas is clear until they click in it again (which adds a point). I thought there may be a way to call repaint() when the window is Deiconified but I get the error that repaint() cannt be called from a static context etc. etc.

Is there any way around this? If someone can explain how to call repaint() from other classes aswell that would be great.

Thanks in advance!
[ July 14, 2006: Message edited by: Dan Grieve ]
 
Dan Grieve
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm also using a BufferedImage in my update() method if that helps!

Forgot to mention that
 
Dan Grieve
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now Solved! Incase anyone wanted to know I had to implement Runnable on my Canvas class and just set it to call repaint() after sleeping for a set amount of time.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . but how did you manage to call repaint() from a static context in the first place?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!