public class ImageCache extends Object
Modifier and Type | Field and Description |
---|---|
protected static ImageCache |
defaultImageCache
The default singleton image cache instance.
|
protected Image |
dummy
The dummy image used to mark a not found image (and avoid trying to
reload it again and again).
|
protected HashMap<String,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.
|
Image |
getDummyImage()
A dummy 16x16 image.
|
Image |
getImage(String fileNameOrUrl)
Lookup an image based on its name, if found return it, else try to load
it.
|
Image |
getImage(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 HashMap<String,Image> imageCache
protected Image dummy
protected static ImageCache defaultImageCache
public ImageCache()
public static ImageCache defaultImageCache()
public Image getImage(String fileNameOrUrl)
fileNameOrUrl
- A file name or an URL pointing at the image.public Image getImage(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 Image getDummyImage()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses