public class ImageCache
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static ImageCache |
defaultImageCache
The default singleton image cache instance.
|
protected java.awt.Image |
dummy
The dummy image used to mark a not found image (and avoid trying to
reload it again and again).
|
protected java.util.Map<java.lang.String,java.awt.Image> |
imageCache
The image cache.
|
| Constructor and Description |
|---|
ImageCache()
New empty image cache.
|
| Modifier and Type | Method and Description |
|---|---|
static ImageCache |
defaultImageCache()
Default singleton image cache instance that can be shared.
|
java.awt.Image |
getDummyImage()
A dummy 16x16 image.
|
java.awt.Image |
getImage(java.lang.String fileNameOrUrl)
Lookup an image based on its name, if found return it, else try to load
it.
|
java.awt.Image |
getImage(java.lang.String fileNameOrUrl,
boolean forceTryReload)
The same as
getImage(String) but you can force the cache to try
to reload an image that where not found before. |
protected final java.util.Map<java.lang.String,java.awt.Image> imageCache
protected final java.awt.Image dummy
protected static ImageCache defaultImageCache
public static ImageCache defaultImageCache()
public java.awt.Image getImage(java.lang.String fileNameOrUrl)
fileNameOrUrl - A file name or an URL pointing at the image.public java.awt.Image getImage(java.lang.String fileNameOrUrl,
boolean forceTryReload)
getImage(String) but you can force the cache to try
to reload an image that where not found before.fileNameOrUrl - A file name or an URL pointing at the image.forceTryReload - If true, try to reload an image that where not found before.public java.awt.Image getDummyImage()