I have an application that should load an image to be set as an icon for a JLabel from JPEG files. The file names are numbers ie. (0.jpg, 1.jpg, ...) so that i can choose the files with a loop and use the loop index as the image name to be retrieved. Depending on some user action the picture should be set visible for about 5 seconds, set invisible, unload the image, retrieve the next image and then depending on the user action, show it again for another couple of seconds. The way I am doing it it takes the image a long time to be shown. I thought by loading it before I would actually need it that it would speed things up, but thats not what happens. It takes a long time for the image to visible. I have a resource manager class responsible for creating the images from the jpegs. They also have to be resized so that may be why it is taking so long. Here's the resource class makeImage method.
The load and show picture methods are in another class that defines a picture panel
So if the user action is appropriate then the picture panel should be displayed and another one loaded up. I thought using the SwingUtlities would solve any thread issues. Is there some additional thread sequencing that I should do in order for the action to be faster? Thanks for the suggestions.
[ June 23, 2004: Message edited by: Chris Ramsey ] [ June 23, 2004: Message edited by: Chris Ramsey ]
This works fast on my computer. If it's still too slow for you I suggest you explore using the createCompatibleImage method in the GraphicsConfiguration class. I've read it can make a difference in rendering time.
Joined: Sep 15, 2003
Thanks Craig! Will try this approach.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com