Package resources

Class IconProvider


  • public class IconProvider
    extends java.lang.Object
    A class that knows how to provide an icon and the URL for that icon. If getUrl() returns a non-null value, then that is the URL used to originally load the icon in this class.

    If getUrl() returns null, then getOrCreateUrl() can be used to create a value URL by writing out the image for this class's icon.

    • Constructor Summary

      Constructors 
      Constructor Description
      IconProvider​(javax.swing.ImageIcon icon, java.net.URL url)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.ImageIcon getIcon()  
      java.net.URL getOrCreateUrl()
      Returns the value of getUrl() if it is non-null.
      java.net.URL getUrl()  
      boolean isInvalid()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IconProvider

        public IconProvider​(javax.swing.ImageIcon icon,
                            java.net.URL url)
    • Method Detail

      • getIcon

        public javax.swing.ImageIcon getIcon()
      • isInvalid

        public boolean isInvalid()
      • getUrl

        public java.net.URL getUrl()
      • getOrCreateUrl

        public java.net.URL getOrCreateUrl()
        Returns the value of getUrl() if it is non-null. Otherwise, this class will attempt to create a temporary file containing the image of this class in order to return a URL for that temp file. If a temporary file could not be created, then the URL returned from this class will point to the default icon.
        Returns:
        the URL