Class ImageLoadingThread

  extended by java.lang.Thread
      extended by
          extended by
              extended by
All Implemented Interfaces:

public final class ImageLoadingThread
extends WatchableGLThread

A class that provides an easy way to load Images in a separate Thread. This is bound by the same problems as with a WatchableGLThread. It's quite easy to make one's own loading Thread, and in fact, this is a recommended way of loading things in the background - you can more closely tie the functionality with your needs. However, this class illustrates a simple way to load images while keeping track of the total progress, and if you simply want a fast and easy method to create some Images from file references, then this is for you.

Chris Molini

Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
Field Summary
private  java.lang.String[] filepaths
          The supplied list of filepaths that are used to load images.
private  Image[] images
          The list of constructed Images.
Fields inherited from class
Fields inherited from class
progress, total
Fields inherited from class java.lang.Thread
Constructor Summary
ImageLoadingThread(java.lang.String[] filepaths)
          Instantiates a Thread that will load images from the list of filepaths.
Method Summary
protected  void act()
          Loads the images, and increments the progress counter.
 Image[] images()
          Accesses a reference to the array of images in the loading Thread.
Methods inherited from class
contextSharingFailed, contextSharingResult, contextSharingSuccess, releaseContext, run, shareContext
Methods inherited from class
complete, percentComplete
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail


private java.lang.String[] filepaths
The supplied list of filepaths that are used to load images.


private Image[] images
The list of constructed Images.

Constructor Detail


public ImageLoadingThread(java.lang.String[] filepaths)
Instantiates a Thread that will load images from the list of filepaths. NOTE: Each of these Images will have its appropriate filepath as a reference.

filepaths - The locations in the file system of the images to load.
Method Detail


protected void act()
Loads the images, and increments the progress counter.

Specified by:
act in class WatchableThread


public Image[] images()
Accesses a reference to the array of images in the loading Thread. This shouldn't be used until loading is complete.

The list of created Images.