Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Swing delaying
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Soler




PostPosted: 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
Sponsor
sponsor
Euphoracle




PostPosted: 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




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: