Swing delaying
Author |
Message |
Soler
|
Posted: Sat Jan 05, 2008 4:59 pm Post subject: Swing delaying |
|
|
I'm trying to create some sort of a movie program where it shows one picture, waits like half a second and shows the other picture. Right now, my coding is:
Show first picture;
Thread.sleep (500);
Show second picture;
Thread.sleep (500);
Show third picture;
So, what i want to happen is These series of picture being shown after another. But what happens is that it shows the first picture, waits 1 second, and then shows the last picture, skipping the second one. I think the problem is probably because I'm using the swing class, but can anyone help me find a way to solve this?
Thanks in advance |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Euphoracle
|
Posted: Sat Jan 05, 2008 7:28 pm Post subject: RE:Swing delaying |
|
|
When you use Thread.sleep, the Swing dialog probably isn't drawing the picture. That's really the only thing I can think of, unless, of course, you forgot a certain part of code that instructs it to draw it (something like panel.refresh() or something), or you have the filename wrong and it is simply drawing the third image thinking it is the first. |
|
|
|
|
|
Aziz
|
Posted: Sun Jan 06, 2008 7:31 am Post subject: RE:Swing delaying |
|
|
That is most likely the problem. You'll have to call something life repaint() on the panel you're drawing too after each image drawing. |
|
|
|
|
|
|
|