Class ImageWrapperResizableIcon
java.lang.Object
org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon
- All Implemented Interfaces:
Icon
,AsynchronousLoading
,ResizableIcon
Implementation of
ResizableIcon
interface that wraps image files.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,
BufferedImage> Contains all precomputed images.protected int
The height of the current image.protected Image
The input stream of the original image.protected InputStream
The input stream of the original image.protected EventListenerList
The listeners.protected BufferedImage
The original image.protected int
The width of the current image. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds listener on the asynchronous loading events.protected void
fireAsyncCompleted
(Boolean event) Fires the asynchronous load event.static ImageWrapperResizableIcon
Returns the icon for the specified URL.static ImageWrapperResizableIcon
getIcon
(InputStream inputStream, Dimension initialDim) Returns the icon for the specified input stream.static ImageWrapperResizableIcon
Returns the icon for the specified URL.int
int
boolean
Returns indication whether the content is still loading.void
void
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
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 Details
-
originalImage
The original image. -
imageInputStream
The input stream of the original image. -
image
The input stream of the original image. -
cachedImages
Contains all precomputed images. -
width
protected int widthThe width of the current image. -
height
protected int heightThe height of the current image. -
listenerList
The listeners.
-
-
Method Details
-
getIcon
Returns the icon for the specified URL.- Parameters:
image
- Image.initialDim
- Initial dimension of the icon.- Returns:
- Icon instance.
-
getIcon
Returns the icon for the specified URL.- Parameters:
location
- Icon URL.initialDim
- Initial dimension of the icon.- Returns:
- Icon instance.
-
getIcon
Returns the icon for the specified input stream.- Parameters:
inputStream
- Icon input stream.initialDim
- Initial dimension of the icon.- Returns:
- Icon instance.
-
setDimension
Description copied from interface:ResizableIcon
Changes the dimension ofthis
icon.- Specified by:
setDimension
in interfaceResizableIcon
- Parameters:
dim
- New dimension forthis
icon.
-
addAsynchronousLoadListener
Description copied from interface:AsynchronousLoading
Adds listener on the asynchronous loading events.- Specified by:
addAsynchronousLoadListener
in interfaceAsynchronousLoading
- Parameters:
l
- Listener to add.
-
removeAsynchronousLoadListener
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
-
paintIcon
-
setPreferredSize
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
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.
-