Class IcoWrapperResizableIcon

  • All Implemented Interfaces:
    javax.swing.Icon, org.pushingpixels.neon.api.icon.ResizableIcon


    public class IcoWrapperResizableIcon
    extends java.lang.Object
    implements org.pushingpixels.neon.api.icon.ResizableIcon
    Implementation of ResizableIcon interface that wraps ICO files.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.pushingpixels.neon.api.icon.ResizableIcon

        org.pushingpixels.neon.api.icon.ResizableIcon.Factory
    • Field Summary

      Fields 
      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 double scale  
      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​(org.pushingpixels.neon.api.AsynchronousLoadListener l)  
      protected void fireAsyncCompleted​(java.lang.Boolean event)
      Fires the asynchronous load event.
      static IcoWrapperResizableIcon getIcon​(java.io.InputStream inputStream, double scale, java.awt.Dimension initialDim)
      Returns the icon for the specified input stream.
      static IcoWrapperResizableIcon getIcon​(java.net.URL location, double scale, java.awt.Dimension initialDim)
      Returns the icon for the specified URL.
      int getIconHeight​()  
      int getIconWidth​()  
      boolean isLoading​()  
      void paintIcon​(java.awt.Component c, java.awt.Graphics g, int x, int y)  
      void removeAsynchronousLoadListener​(org.pushingpixels.neon.api.AsynchronousLoadListener l)  
      protected void renderImage​(int renderWidth, int renderHeight)
      Renders the image.
      void setDimension​(java.awt.Dimension dim)  
      void setPreferredSize​(java.awt.Dimension dim)
      Sets the preferred size for this icon.
      • Methods inherited from interface javax.swing.Icon

        getIconHeight, getIconWidth, paintIcon
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.pushingpixels.neon.api.icon.ResizableIcon

        toImage
    • Field Detail

      • icoInputStream

        protected java.io.InputStream icoInputStream
        The input stream of the original image.
      • icoPlaneMap

        protected java.util.Map<java.lang.Integer,java.awt.image.BufferedImage> icoPlaneMap
        Image planes of the original ICO 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.
      • scale

        protected double scale
      • listenerList

        protected javax.swing.event.EventListenerList listenerList
        The listeners.
    • Method Detail

      • getIcon

        public static IcoWrapperResizableIcon getIcon​(java.net.URL location,
                                                      double scale,
                                                      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,
                                                      double scale,
                                                      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:
        setDimension in interface org.pushingpixels.neon.api.icon.ResizableIcon
      • addAsynchronousLoadListener

        public void addAsynchronousLoadListener​(org.pushingpixels.neon.api.AsynchronousLoadListener l)
        Specified by:
        addAsynchronousLoadListener in interface org.pushingpixels.neon.api.AsynchronousLoading
      • removeAsynchronousLoadListener

        public void removeAsynchronousLoadListener​(org.pushingpixels.neon.api.AsynchronousLoadListener l)
        Specified by:
        removeAsynchronousLoadListener in interface org.pushingpixels.neon.api.AsynchronousLoading
      • 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.
      • 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:
        isLoading in interface org.pushingpixels.neon.api.AsynchronousLoading