Well, I don't exactely know how it works but I'm also making a game in Java, and when the client starts up, I want it to load all its images so that the rest of the game would run smoothly.
I put them all in an array of images. The first screen displays fine(only contains 4 different images of the +-30 I put in the array).
But for level edditing I have a tree in wich you can select your image and then place it on the screen on the position you want. So when the user clicks the 'level edit' button, I want to show the frame with the tree, and I pass it the array of images. The frame then puts all the images in the tree, but not all images are displayed in the tree. When I close the frame and click again, then all the images are shown. Just like they only get loaded once they have to be painted for the first time.
I have a solution for the problem but its not a beatiful one..when the program starts up, I let it paint al its images to a small buffer so that the images start loading.
between 2 paints, I put a small sleep (50ms) to give it time to load, otherwise it doesn't work.
Since I work differently (use imageIcon to load image), I hoped that your way of working would actually load the file when you ask it to.
Greetz,
NOSPAM_themuppeteer@hotmail.com (for mails, remove the NOSPAM_)
"Those who say they understand chess, understand nothing"
-- Robert HUBNER