Images in Jars


Images in Jars

Here are two utility classes.

The first is designed to help with loading images, (from both inside and outside jar files).

The second is a wrapper around the first, is is designed to help speed up loading batches of images.


A class containing static methods which load images - including images within jar files.


A wrapper around the ImageLoader class...

This class keeps track of which images have been loaded - and provides a method to check to see if they have all been loaded...

To use it, repeatedly (once for each image) call:
ImageLoadingManager.getImage("graphics/imagename.gif"); early as possible during your setup.

Then, in your main thread, just before you need to use the images you can make sure they have all loaded using code like:

do {
  try {
  catch (InterruptedException e) {
} while (!ImageLoadingManager.allImagesAreLoaded());

This method of loading the images is used because it is fast - much faster than waiting for individual images to load.

If you don't need to ensure your images have loaded, use the ImageLoader class directly.