jsky.util
Class ResourceMap

java.lang.Object
  extended by jsky.util.ResourceMap

public final class ResourceMap
extends java.lang.Object

A ResourceMap provdes a map of resources such that frequently used resources, such as images and icons can be reused.

Currently, this is a simple HashMap, but could be evolved to use weak references.

Currently only Icon special routines are implemented.


Constructor Summary
ResourceMap()
          Create a new ResourceMap.
ResourceMap(int capacity)
          Create a new ResourceMap with a start up capacity.
 
Method Summary
 javax.swing.Icon getIcon(java.lang.String iconName)
          Checks and returns a cached Icon.
 void storeIcon(java.lang.String iconName, javax.swing.Icon icon)
          Stores an Icon with the given resourceName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceMap

public ResourceMap()
Create a new ResourceMap.


ResourceMap

public ResourceMap(int capacity)
Create a new ResourceMap with a start up capacity.

Method Detail

getIcon

public javax.swing.Icon getIcon(java.lang.String iconName)
Checks and returns a cached Icon.

Returns:
the cached Icon or null if not present.

storeIcon

public void storeIcon(java.lang.String iconName,
                      javax.swing.Icon icon)
Stores an Icon with the given resourceName.