dsto.dfc.swing.icons
Class ResourceImageIcon
java.lang.Object
javax.swing.ImageIcon
dsto.dfc.swing.icons.ResourceImageIcon
- All Implemented Interfaces:
- ImageObserver, Serializable, Accessible, Icon
public class ResourceImageIcon
- extends ImageIcon
- implements Icon, Serializable, ImageObserver
An icon that is loaded from a resource. The icon image is lazy
loaded to speed up application initialization.
Unfortunately the Swing designers have implemented auto-greying of
icons only for ImageIcon's (by hardcoding calls to
ImageIcon.getImage(): see AbstractButton for an
example), so this class has to extend ImageIcon and override all its methods
for icon disabling to work. If Sun ever fix this, the 'extends ImageIcon' may
be removed.
- Version:
- $Revision$
- See Also:
- Serialized Form
resourceName
protected String resourceName
image
protected transient Image image
imageWidth
protected transient int imageWidth
imageHeight
protected transient int imageHeight
failedToLoadImage
protected transient boolean failedToLoadImage
ResourceImageIcon
public ResourceImageIcon(String resourceName)
paintIcon
public void paintIcon(Component c,
Graphics g,
int x,
int y)
- Specified by:
paintIcon in interface Icon- Overrides:
paintIcon in class ImageIcon
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth in interface Icon- Overrides:
getIconWidth in class ImageIcon
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight in interface Icon- Overrides:
getIconHeight in class ImageIcon
imageUpdate
public boolean imageUpdate(Image img,
int infoflags,
int x,
int y,
int width,
int height)
- Specified by:
imageUpdate in interface ImageObserver
getImageLoadStatus
public int getImageLoadStatus()
- Overrides:
getImageLoadStatus in class ImageIcon
getImage
public Image getImage()
- Overrides:
getImage in class ImageIcon
setImage
public void setImage(Image image)
- Overrides:
setImage in class ImageIcon
Copyright © 2008 Commonwealth of Australia