Forums Register Login

Maximizing + Restoring Image on Canvas * SOLVED *

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
I'm also using a BufferedImage in my update() method if that helps!

Forgot to mention that
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
. . . but how did you manage to call repaint() from a static context in the first place?
Just let me do the talking. Ahem ... so ... you see ... we have this tiny ad...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 572 times.
Similar Threads
Emulator v.s. i88s device
refreshing canvas
problem in using paint
drawstring on canvas
drawstring on canvas
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:58:25.