Very strange problem with animation

I’m working on an animation class for a game I’m making.
In the class it takes a series of imageicon instances and stores them in an array. It uses a Thread defined in an inner class to create animation with them, swapping between the pictures. It outputs the current image to a series of JPanels using the paintIcon method of the ImageIcon class, so that they all display the exact same animation at the exact same time. This part works fine.
It also can save them all together in a file using ObjectOutputStream. The problem occurs when I load them from the file using ObjectOutStream. I immediately set out to use that same thread to animate them. Right now I’m testing it on 6 JPanels. The odd part is that the last five animate perfectly fine. But the first one sort of “flickers” at first. At the current speed of about an image change every second or two, it clearly displays nothing during some of the first few image show ups. This seems to happen randomly. After enough images move along, the problem stops completely, even if I have the images cycle back to the beginning and start animating again.
I spent 3 hours testing out the problem and drew the following conclusions. 1) The problem does not occur until I execute the readObject statement. (Of course if I do this, I have to have a bunch of imageicon instances that aren’t from a compiled file) 2) If I put a statement that tells it to paint one of the images to a particular JPanel before the for loop that prints them all, that particular JPanel is the one that flickers instead.
I tried running it on a machine in a computer lab and it worked fine there. Thus I suspect it is a system specific problem. Someone else suggested updating my graphic drivers and downloading a new version of the java runtime environment. I downloaded a newer driver for my s3 prosavage ddr card, and I have a recent copy of the java runtime environment. I’m not sure if JBuilder uses that directly, though. I have JBuilder Personal 9.0.
If anyone has insight as to what’s causing my problem, please let me know.
Thanks,
qb_mon

sounds like you’re loading your Images using a method that isn’t synchronized. Check out MediaTracker to wait for them to load or just load your images using ImageIO. If you don’t have them completely loaded and you try to draw them, they might not show up right away when you call for them, which would explain your first few missing frames.

One of the things I tried early on was having it load all the imageicons from the animation file as soon as the application loaded. I waited a little bit to give it time to do this, then pressed the button that told it to specifically load the images fresh from the file. It still had the same problem.
I also tried dinking with media tracker then and it didn’t seem to relay any failure. Then again I’m pretty inexperienced with media tracker, so I ought to try it again.
I’ll be glad to look into synchronizing the method(s), using media tracker, and imageio, though I’m not sure what you meant by imageio. Right now I’m busy with schoolwork though.
Thanks,
qb_mon

ImageIO just loads your image
BufferedImage img = sourceImage = ImageIO.read(url);