jsky.util
Class ResourceMap

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

public final class ResourceMap
extends 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
 Icon getIcon(String iconName)
          Checks and returns a cached Icon.
 void storeIcon(String iconName, 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 Icon getIcon(String iconName)
Checks and returns a cached Icon.

Returns:
the cached Icon or null if not present.

storeIcon

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



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.