NCSA Portfolio

Class TextureCache


public class TextureCache
extends java.util.Hashtable

This object is used to retrieve textures that are loaded into the system. TextureCache uses references to textures instead of reloading the texture over and over again, which it saves memory.

Note that textures you wish to use do not have to be put into the TextureCache beforehand; using the get method will retrieve textures if they aren't in the TextureCache already.

See Also:
Serialized Form

Constructor Summary
TextureCache(java.awt.Component comp)
Method Summary
 java.lang.Object get(java.lang.String name)
          Retrieves a texture.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, remove, size, toString, values
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public TextureCache(java.awt.Component comp)
Method Detail


public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
put in class java.util.Hashtable


public java.lang.Object get(java.lang.String name)
Retrieves a texture. It first looks in the cache, and will retrieve from disk if it hasn't already been loaded.
name - The name of the texture to load.

NCSA Portfolio

NCSA Portfolio, Copyright 1997-1999, National Center for Supercomputing Applications, University of Illinois Urbana-Champaign, All Rights Reserved