Class ImageWrapperResizableIcon
- java.lang.Object
-
- org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon
-
- All Implemented Interfaces:
javax.swing.Icon,org.pushingpixels.neon.api.icon.ResizableIcon
public class ImageWrapperResizableIcon extends java.lang.Object implements org.pushingpixels.neon.api.icon.ResizableIconImplementation ofResizableIconinterface that wraps image files.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.awt.image.BufferedImage>cachedImagesContains all precomputed images.protected intheightThe height of the current image.protected java.awt.ImageimageThe input stream of the original image.protected java.io.InputStreamimageInputStreamThe input stream of the original image.protected javax.swing.event.EventListenerListlistenerListThe listeners.protected java.awt.image.BufferedImageoriginalImageThe original image.protected intwidthThe width of the current image.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAsynchronousLoadListener(org.pushingpixels.neon.api.AsynchronousLoadListener l)protected voidfireAsyncCompleted(java.lang.Boolean event)Fires the asynchronous load event.static ImageWrapperResizableIcongetIcon(java.awt.Image image, java.awt.Dimension initialDim)Returns the icon for the specified URL.static ImageWrapperResizableIcongetIcon(java.io.InputStream inputStream, java.awt.Dimension initialDim)Returns the icon for the specified input stream.static ImageWrapperResizableIcongetIcon(java.net.URL location, java.awt.Dimension initialDim)Returns the icon for the specified URL.intgetIconHeight()intgetIconWidth()booleanisLoading()voidpaintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)voidremoveAsynchronousLoadListener(org.pushingpixels.neon.api.AsynchronousLoadListener l)protected voidrenderImage(int renderWidth, int renderHeight)Renders the image.voidsetDimension(java.awt.Dimension dim)voidsetPreferredSize(java.awt.Dimension dim)Sets the preferred size forthisicon.
-
-
-
Field Detail
-
originalImage
protected java.awt.image.BufferedImage originalImage
The original image.
-
imageInputStream
protected java.io.InputStream imageInputStream
The input stream of the original image.
-
image
protected java.awt.Image image
The input stream of the original image.
-
cachedImages
protected java.util.Map<java.lang.String,java.awt.image.BufferedImage> cachedImages
Contains all precomputed images.
-
width
protected int width
The width of the current image.
-
height
protected int height
The height of the current image.
-
listenerList
protected javax.swing.event.EventListenerList listenerList
The listeners.
-
-
Method Detail
-
getIcon
public static ImageWrapperResizableIcon getIcon(java.awt.Image image, java.awt.Dimension initialDim)
Returns the icon for the specified URL.- Parameters:
image- Image.initialDim- Initial dimension of the icon.- Returns:
- Icon instance.
-
getIcon
public static ImageWrapperResizableIcon getIcon(java.net.URL location, java.awt.Dimension initialDim)
Returns the icon for the specified URL.- Parameters:
location- Icon URL.initialDim- Initial dimension of the icon.- Returns:
- Icon instance.
-
getIcon
public static ImageWrapperResizableIcon getIcon(java.io.InputStream inputStream, java.awt.Dimension initialDim)
Returns the icon for the specified input stream.- Parameters:
inputStream- Icon input stream.initialDim- Initial dimension of the icon.- Returns:
- Icon instance.
-
setDimension
public void setDimension(java.awt.Dimension dim)
- Specified by:
setDimensionin interfaceorg.pushingpixels.neon.api.icon.ResizableIcon
-
addAsynchronousLoadListener
public void addAsynchronousLoadListener(org.pushingpixels.neon.api.AsynchronousLoadListener l)
- Specified by:
addAsynchronousLoadListenerin interfaceorg.pushingpixels.neon.api.AsynchronousLoading
-
removeAsynchronousLoadListener
public void removeAsynchronousLoadListener(org.pushingpixels.neon.api.AsynchronousLoadListener l)
- Specified by:
removeAsynchronousLoadListenerin interfaceorg.pushingpixels.neon.api.AsynchronousLoading
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidthin interfacejavax.swing.Icon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeightin interfacejavax.swing.Icon
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)- Specified by:
paintIconin interfacejavax.swing.Icon
-
setPreferredSize
public void setPreferredSize(java.awt.Dimension dim)
Sets the preferred size forthisicon. The rendering is scheduled automatically.- Parameters:
dim- Preferred size.
-
renderImage
protected void renderImage(int renderWidth, int renderHeight)Renders the image.- Parameters:
renderWidth- Requested rendering width.renderHeight- Requested rendering height.
-
fireAsyncCompleted
protected void fireAsyncCompleted(java.lang.Boolean event)
Fires the asynchronous load event.- Parameters:
event- Event object.
-
isLoading
public boolean isLoading()
- Specified by:
isLoadingin interfaceorg.pushingpixels.neon.api.AsynchronousLoading
-
-