Class IcoWrapperResizableIcon
- java.lang.Object
-
- org.pushingpixels.flamingo.api.common.icon.IcoWrapperResizableIcon
-
- All Implemented Interfaces:
Icon
,AsynchronousLoading
,ResizableIcon
public class IcoWrapperResizableIcon extends Object implements ResizableIcon
Implementation ofResizableIcon
interface that wraps ICO files.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,BufferedImage>
cachedImages
Contains all precomputed images.protected int
height
The height of the current image.protected InputStream
icoInputStream
The input stream of the original image.protected Map<Integer,BufferedImage>
icoPlaneMap
Image planes of the original ICO image.protected EventListenerList
listenerList
The listeners.protected int
width
The width of the current image.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAsynchronousLoadListener(AsynchronousLoadListener l)
Adds listener on the asynchronous loading events.protected void
fireAsyncCompleted(Boolean event)
Fires the asynchronous load event.static IcoWrapperResizableIcon
getIcon(InputStream inputStream, Dimension initialDim)
Returns the icon for the specified input stream.static IcoWrapperResizableIcon
getIcon(URL location, Dimension initialDim)
Returns the icon for the specified URL.int
getIconHeight()
int
getIconWidth()
boolean
isLoading()
Returns indication whether the content is still loading.void
paintIcon(Component c, Graphics g, int x, int y)
void
removeAsynchronousLoadListener(AsynchronousLoadListener l)
Removes listener on the asynchronous loading events.protected void
renderImage(int renderWidth, int renderHeight)
Renders the image.void
setDimension(Dimension dim)
Changes the dimension ofthis
icon.void
setPreferredSize(Dimension dim)
Sets the preferred size forthis
icon.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.swing.Icon
getIconHeight, getIconWidth, paintIcon
-
-
-
-
Field Detail
-
icoInputStream
protected final InputStream icoInputStream
The input stream of the original image.
-
icoPlaneMap
protected Map<Integer,BufferedImage> icoPlaneMap
Image planes of the original ICO image.
-
cachedImages
protected Map<String,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 EventListenerList listenerList
The listeners.
-
-
Method Detail
-
getIcon
public static IcoWrapperResizableIcon getIcon(URL location, 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 IcoWrapperResizableIcon getIcon(InputStream inputStream, 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(Dimension dim)
Description copied from interface:ResizableIcon
Changes the dimension ofthis
icon.- Specified by:
setDimension
in interfaceResizableIcon
- Parameters:
dim
- New dimension forthis
icon.
-
addAsynchronousLoadListener
public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoading
Adds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListener
in interfaceAsynchronousLoading
- Parameters:
l
- Listener to add.
-
removeAsynchronousLoadListener
public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface:AsynchronousLoading
Removes listener on the asynchronous loading events.- Specified by:
removeAsynchronousLoadListener
in interfaceAsynchronousLoading
- Parameters:
l
- Listener to remove.
-
getIconWidth
public int getIconWidth()
- Specified by:
getIconWidth
in interfaceIcon
-
getIconHeight
public int getIconHeight()
- Specified by:
getIconHeight
in interfaceIcon
-
setPreferredSize
public void setPreferredSize(Dimension dim)
Sets the preferred size forthis
icon. 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(Boolean event)
Fires the asynchronous load event.- Parameters:
event
- Event object.
-
isLoading
public boolean isLoading()
Description copied from interface:AsynchronousLoading
Returns indication whether the content is still loading.- Specified by:
isLoading
in interfaceAsynchronousLoading
- Returns:
true
if the content is still loading,false
otherwise.
-
-