Class GifResource

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String CLASS
      target/classes/: the directory of the classfiles within the simuline-developing environment. **** bad: path is hardcoded ****
      private static java.lang.String CLASS_END
      The ending of a java class file.
      private static java.lang.String GIF_END
      The ending of a gif file.
      private static java.util.Map<java.lang.Class<?>,​javax.swing.ImageIcon> GIFS
      A cache for gif-files represented by GifResources.
      private static java.lang.String RESOURCE
      src/main/resource/: the directory of the resources within simuline-developing environment. **** bad: path is hardcoded ****
      private static java.lang.String URL_SEP
      The separator in urls.
    • Constructor Summary

      Constructors 
      Constructor Description
      GifResource()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.swing.ImageIcon getIcon​(java.lang.Class<? extends GifResource> res)
      Converts a GifResource class into the corresponding icon.
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

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

      • URL_SEP

        private static final java.lang.String URL_SEP
        The separator in urls. Note that this is unified unlike file separators which depend on the operating system.
        See Also:
        Constant Field Values
      • CLASS_END

        private static final java.lang.String CLASS_END
        The ending of a java class file.
        See Also:
        Constant Field Values
      • GIF_END

        private static final java.lang.String GIF_END
        The ending of a gif file.
        See Also:
        Constant Field Values
      • CLASS

        private static final java.lang.String CLASS
        target/classes/: the directory of the classfiles within the simuline-developing environment. **** bad: path is hardcoded ****
        See Also:
        Constant Field Values
      • RESOURCE

        private static final java.lang.String RESOURCE
        src/main/resource/: the directory of the resources within simuline-developing environment. **** bad: path is hardcoded ****
        See Also:
        Constant Field Values
      • GIFS

        private static final java.util.Map<java.lang.Class<?>,​javax.swing.ImageIcon> GIFS
        A cache for gif-files represented by GifResources.
    • Constructor Detail

      • GifResource

        public GifResource()
    • Method Detail

      • getIcon

        public static javax.swing.ImageIcon getIcon​(java.lang.Class<? extends GifResource> res)
        Converts a GifResource class into the corresponding icon. This is done in the following steps: If the image is cached in GIFS, take this one. Else load it into GIFSas described below before taking it from GIFS.

        Loading an image consists in loading the class-file associated with the image, determining the according gif-file and creating the according ImageIcon.

        Parameters:
        res - a subclass of GifResource.
        Returns:
        the icon determined by the given class.

        CAUTION: Note that an icon is returned even if there is no according gif-image. This image can be identified by width -1 which is an undocumented property.

      • main

        public static final void main​(java.lang.String[] args)