Package resources.icons
Class ImageIconWrapper
- java.lang.Object
-
- javax.swing.ImageIcon
-
- resources.icons.ImageIconWrapper
-
- All Implemented Interfaces:
java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.Icon
,FileBasedIcon
- Direct Known Subclasses:
DisabledImageIconWrapper
,ScaledImageIconWrapper
public class ImageIconWrapper extends javax.swing.ImageIcon implements FileBasedIcon
ImageIconWrapper
provides the ability to instantiate an ImageIcon with delayed loading. In addition to delayed loading it has the added benefit of allowing the use of static initialization of ImageIcons without starting the Swing thread which can cause problems when running headless.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ImageIconWrapper(byte[] imageBytes, java.lang.String imageName)
Construct wrapped ImageIcon based upon specified image byte array (seeToolkit.createImage(byte[])
)ImageIconWrapper(java.awt.Image image, java.lang.String imageName)
Construct wrapped ImageIcon based upon specified imageImageIconWrapper(java.net.URL url)
Construct wrapped ImageIcon based upon specified resource URLImageIconWrapper(javax.swing.Icon icon)
Construct wrapped ImageIcon based upon specified icon which may require transformation into ImageIcon
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.awt.Image
createIconBaseImage()
Get the base icon image to be transformed in ImageIconprotected javax.swing.ImageIcon
createImageIcon()
javax.accessibility.AccessibleContext
getAccessibleContext()
java.lang.String
getDescription()
java.lang.String
getFilename()
Get the name of the image which in most cases will be the associated data file path.int
getIconHeight()
int
getIconWidth()
java.awt.Image
getImage()
int
getImageLoadStatus()
java.lang.String
getImageName()
Get icon reference namejava.awt.image.ImageObserver
getImageObserver()
void
paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
void
setDescription(java.lang.String description)
void
setImage(java.awt.Image image)
java.lang.String
toString()
-
-
-
Constructor Detail
-
ImageIconWrapper
public ImageIconWrapper(byte[] imageBytes, java.lang.String imageName)
Construct wrapped ImageIcon based upon specified image byte array (seeToolkit.createImage(byte[])
)- Parameters:
imageBytes
- image bytesimageName
- image reference name
-
ImageIconWrapper
public ImageIconWrapper(java.awt.Image image, java.lang.String imageName)
Construct wrapped ImageIcon based upon specified image- Parameters:
image
- icon imageimageName
- image reference name
-
ImageIconWrapper
public ImageIconWrapper(javax.swing.Icon icon)
Construct wrapped ImageIcon based upon specified icon which may require transformation into ImageIcon- Parameters:
icon
- the icon
-
ImageIconWrapper
public ImageIconWrapper(java.net.URL url)
Construct wrapped ImageIcon based upon specified resource URL- Parameters:
url
- icon image resource URL
-
-
Method Detail
-
getFilename
public java.lang.String getFilename()
Description copied from interface:FileBasedIcon
Get the name of the image which in most cases will be the associated data file path.- Specified by:
getFilename
in interfaceFileBasedIcon
- Returns:
- icon name/path
-
getImageName
public java.lang.String getImageName()
Get icon reference name- Returns:
- icon name
-
getImage
public java.awt.Image getImage()
- Overrides:
getImage
in classjavax.swing.ImageIcon
-
getAccessibleContext
public javax.accessibility.AccessibleContext getAccessibleContext()
- Specified by:
getAccessibleContext
in interfacejavax.accessibility.Accessible
- Overrides:
getAccessibleContext
in classjavax.swing.ImageIcon
-
getDescription
public java.lang.String getDescription()
- Overrides:
getDescription
in classjavax.swing.ImageIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfacejavax.swing.Icon
- Overrides:
getIconHeight
in classjavax.swing.ImageIcon
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfacejavax.swing.Icon
- Overrides:
getIconWidth
in classjavax.swing.ImageIcon
-
getImageLoadStatus
public int getImageLoadStatus()
- Overrides:
getImageLoadStatus
in classjavax.swing.ImageIcon
-
getImageObserver
public java.awt.image.ImageObserver getImageObserver()
- Overrides:
getImageObserver
in classjavax.swing.ImageIcon
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
- Specified by:
paintIcon
in interfacejavax.swing.Icon
- Overrides:
paintIcon
in classjavax.swing.ImageIcon
-
setDescription
public void setDescription(java.lang.String description)
- Overrides:
setDescription
in classjavax.swing.ImageIcon
-
setImage
public void setImage(java.awt.Image image)
- Overrides:
setImage
in classjavax.swing.ImageIcon
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjavax.swing.ImageIcon
-
createIconBaseImage
protected final java.awt.Image createIconBaseImage()
Get the base icon image to be transformed in ImageIcon- Returns:
- the base icon image to be transformed in ImageIcon
-
createImageIcon
protected javax.swing.ImageIcon createImageIcon()
-
-