Class PathIcon

  • All Implemented Interfaces:, javax.accessibility.Accessible, javax.swing.Icon

    public class PathIcon
    extends javax.swing.ImageIcon
    This class loads an icon, possibly stretching and applying filters (color replace, color tint) to it.

    For a long time, this class loaded images asynchronously with the EventQueue thread, updating the imageobserver as they came in. It was changed to instead load images synchronously, opting to store them in an in-memory cache. See ImageLoader This simplifies the code a lot, and was done to eliminate a race condition that was occuring when multiple images were loading the same image, and then applying filters (common). See SVN for old methods and inner classes.

    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  PathIcon.LoadImageTask  
      • Nested classes/interfaces inherited from class javax.swing.ImageIcon

    • Field Summary

      Modifier and Type Field Description
      protected static java.awt.Component COMP  
      protected boolean useCache  
      • Fields inherited from class javax.swing.ImageIcon

    • Constructor Summary

      Constructor Description
      PathIcon​(java.awt.image.ImageObserver observer, java.lang.String path, int w, int h)  
      PathIcon​(java.awt.image.ImageObserver observer, java.lang.String path, int w, int h, boolean useCache, boolean loadInBackground)  
    • Field Detail

      • COMP

        protected static final java.awt.Component COMP
      • useCache

        protected boolean useCache
    • Constructor Detail

      • PathIcon

        public PathIcon()
      • PathIcon

        public PathIcon​(java.awt.image.ImageObserver observer,
                        java.lang.String path,
                        int w,
                        int h)
      • PathIcon

        public PathIcon​(java.awt.image.ImageObserver observer,
                        java.lang.String path,
                        int w,
                        int h,
                        boolean useCache,
                        boolean loadInBackground)
    • Method Detail

      • setLoadInBackground

        public void setLoadInBackground​(boolean loadInBackground)
      • isLoadInBackground

        public boolean isLoadInBackground()
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
        getIconHeight in class javax.swing.ImageIcon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
        getIconWidth in class javax.swing.ImageIcon
      • paintIcon

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

        public void setImage​(java.awt.Image img)
        setImage in class javax.swing.ImageIcon
      • getImage

        public java.awt.Image getImage()
        getImage in class javax.swing.ImageIcon
      • getHeight

        public int getHeight()
      • getImageObserver

        public java.awt.image.ImageObserver getImageObserver()
        getImageObserver in class javax.swing.ImageIcon
      • getWidth

        public int getWidth()
      • setHeight

        public void setHeight​(int i)
      • setStretchSize

        public void setStretchSize​(int w,
                                   int h)
      • reset

        public void reset()
      • setUseCache

        public void setUseCache​(boolean useCache)
      • isUseCache

        public boolean isUseCache()
      • setImageObserver

        public void setImageObserver​(java.awt.image.ImageObserver observer)
        setImageObserver in class javax.swing.ImageIcon
      • setWidth

        public void setWidth​(int i)
      • getPath

        public java.lang.String getPath()
      • getImageLoadingTask

        protected PathIcon.LoadImageTask getImageLoadingTask​(java.lang.String path,
                                                             int sW,
                                                             int sH,
                                                             long mySeq)
      • setPath

        public void setPath​(java.lang.String string)
      • waitForImage

        public static boolean waitForImage​(java.awt.Image image)
      • setFilterA

        public void setFilterA​(java.awt.image.ImageFilter filter)
      • setFilterB

        public void setFilterB​(java.awt.image.ImageFilter filter)
      • doFilters

        public void doFilters​(boolean update)
      • setScaleMode

        public void setScaleMode​(int scaleMode)
        Not used anymore now that scaling is done by the ImageLoader