javax.swing.Icon, AsynchronousLoading, ResizableIconpublic class IcoWrapperResizableIcon extends java.lang.Object implements ResizableIcon
ResizableIcon interface that wraps ICO files.| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.Map<java.lang.String,java.awt.image.BufferedImage> |
cachedImages |
Contains all precomputed images.
|
protected int |
height |
The height of the current image.
|
protected java.io.InputStream |
icoInputStream |
The input stream of the original image.
|
protected java.util.Map<java.lang.Integer,java.awt.image.BufferedImage> |
icoPlaneMap |
Image planes of the original ICO image.
|
protected javax.swing.event.EventListenerList |
listenerList |
The listeners.
|
protected int |
width |
The width of the current image.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addAsynchronousLoadListener(AsynchronousLoadListener l) |
Adds listener on the asynchronous loading events.
|
protected void |
fireAsyncCompleted(java.lang.Boolean event) |
Fires the asynchronous load event.
|
static IcoWrapperResizableIcon |
getIcon(java.io.InputStream inputStream,
java.awt.Dimension initialDim) |
Returns the icon for the specified input stream.
|
static IcoWrapperResizableIcon |
getIcon(java.net.URL location,
java.awt.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(java.awt.Component c,
java.awt.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(java.awt.Dimension dim) |
Changes the dimension of
this icon. |
void |
setPreferredSize(java.awt.Dimension dim) |
Sets the preferred size for
this icon. |
protected final java.io.InputStream icoInputStream
protected java.util.Map<java.lang.Integer,java.awt.image.BufferedImage> icoPlaneMap
protected java.util.Map<java.lang.String,java.awt.image.BufferedImage> cachedImages
protected int width
protected int height
protected javax.swing.event.EventListenerList listenerList
public static IcoWrapperResizableIcon getIcon(java.net.URL location, java.awt.Dimension initialDim)
location - Icon URL.initialDim - Initial dimension of the icon.public static IcoWrapperResizableIcon getIcon(java.io.InputStream inputStream, java.awt.Dimension initialDim)
inputStream - Icon input stream.initialDim - Initial dimension of the icon.public void setDimension(java.awt.Dimension dim)
ResizableIconthis icon.setDimension in interface ResizableIcondim - New dimension for this icon.public void addAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoadingaddAsynchronousLoadListener in interface AsynchronousLoadingl - Listener to add.public void removeAsynchronousLoadListener(AsynchronousLoadListener l)
AsynchronousLoadingremoveAsynchronousLoadListener in interface AsynchronousLoadingl - Listener to remove.public int getIconWidth()
getIconWidth in interface javax.swing.Iconpublic int getIconHeight()
getIconHeight in interface javax.swing.Iconpublic void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
paintIcon in interface javax.swing.Iconpublic void setPreferredSize(java.awt.Dimension dim)
this icon. The rendering is
scheduled automatically.dim - Preferred size.protected void renderImage(int renderWidth,
int renderHeight)
renderWidth - Requested rendering width.renderHeight - Requested rendering height.protected void fireAsyncCompleted(java.lang.Boolean event)
event - Event object.public boolean isLoading()
AsynchronousLoadingisLoading in interface AsynchronousLoadingtrue if the content is still loading,
false otherwise.