public class ImageIconCache
extends java.lang.Object
This class caches instances of ImageIcon using SoftReference
s.
You should therefore avoid permanently caching the returned icons in your own code,
because this could pin icons on the heap unnecessarily.
It is suggested to use this cache wherever an ImageIcon is being constructed in code that may be repetitively or iteratively called. In such cases you may simply replace the code pattern 'new ImageIcon' with 'ImageIconCache.get' to prevent any potential memory leaks or performance overhead from excessive icon creation.
Constructor and Description |
---|
ImageIconCache() |
Modifier and Type | Method and Description |
---|---|
static javax.swing.ImageIcon |
get(java.net.URL location) |