Class ImageParser


  • public class ImageParser
    extends java.lang.Object
    Creates BufferedImage instances from string representations. Each image is loaded only once.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImageParser​(@NotNull JXCSkinSource skinSource)
      Creates a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Forgets all defined images.
      @NotNull java.awt.image.BufferedImage getImage​(@NotNull java.lang.String name)
      Loads an image by base file name.
      @Nullable java.awt.Image getImage​(@Nullable java.awt.Color color, @NotNull java.lang.String name)
      Optionally loads an image by base file name.
      • Methods inherited from class java.lang.Object

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

      • ImageParser

        public ImageParser​(@NotNull
                           @NotNull JXCSkinSource skinSource)
        Creates a new instance.
        Parameters:
        skinSource - the skin source for loading resources
    • Method Detail

      • clear

        public void clear()
        Forgets all defined images.
      • getImage

        @Nullable
        public @Nullable java.awt.Image getImage​(@Nullable
                                                 @Nullable java.awt.Color color,
                                                 @NotNull
                                                 @NotNull java.lang.String name)
                                          throws java.io.IOException
        Optionally loads an image by base file name.
        Parameters:
        color - if non-null, return null
        name - the base file name
        Returns:
        the image, or null if color!=null
        Throws:
        java.io.IOException - if the image cannot be loaded
      • getImage

        @NotNull
        public @NotNull java.awt.image.BufferedImage getImage​(@NotNull
                                                              @NotNull java.lang.String name)
                                                       throws java.io.IOException
        Loads an image by base file name.
        Parameters:
        name - the base file name
        Returns:
        the image
        Throws:
        java.io.IOException - if the image cannot be loaded