org.jvnet.flamingo.common.icon
Class IcoWrapperResizableIcon

java.lang.Object
  extended by org.jvnet.flamingo.common.icon.IcoWrapperResizableIcon
All Implemented Interfaces:
javax.swing.Icon, AsynchronousLoading, ResizableIcon

public class IcoWrapperResizableIcon
extends java.lang.Object
implements ResizableIcon

Implementation of ResizableIcon interface that wraps ICO files.

Author:
Kirill Grouchnikov

Method Summary
 void addAsynchronousLoadListener(AsynchronousLoadListener l)
          Adds listener on the asynchronous loading events.
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.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.Icon
getIconHeight, getIconWidth, paintIcon
 

Method Detail

getIcon

public static IcoWrapperResizableIcon 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 IcoWrapperResizableIcon 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)
Description copied from interface: ResizableIcon
Changes the dimension of this icon.

Specified by:
setDimension in interface ResizableIcon
Parameters:
dim - New dimension for this icon.

addAsynchronousLoadListener

public void addAsynchronousLoadListener(AsynchronousLoadListener l)
Description copied from interface: AsynchronousLoading
Adds listener on the asynchronous loading events.

Specified by:
addAsynchronousLoadListener in interface AsynchronousLoading
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 interface AsynchronousLoading
Parameters:
l - Listener to remove.

getIconWidth

public int getIconWidth()
Specified by:
getIconWidth in interface javax.swing.Icon

getIconHeight

public int getIconHeight()
Specified by:
getIconHeight in interface javax.swing.Icon

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics g,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon

setPreferredSize

public void setPreferredSize(java.awt.Dimension dim)
Sets the preferred size for this icon. The rendering is scheduled automatically.

Parameters:
dim - Preferred size.

isLoading

public boolean isLoading()
Description copied from interface: AsynchronousLoading
Returns indication whether the content is still loading.

Specified by:
isLoading in interface AsynchronousLoading
Returns:
true if the content is still loading, false otherwise.