Class IconUtilities


  • @OpenApiAll
    public class IconUtilities
    extends java.lang.Object
    Utility class to work wih Icons
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.List<java.lang.String> IMAGE_SHAPE_IMAGE_TYPES  
    • Constructor Summary

      Constructors 
      Constructor Description
      IconUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static ResizableIcon getGrayIcon​(javax.swing.Icon icon, java.awt.Component component)
      Returns gray(disabled) icon for a given one.
      static boolean isExistingIconImage​(javax.swing.Icon icon)
      Used to check if icon really contains a valid image
      static boolean isImageFile​(java.io.File file)  
      static java.awt.image.BufferedImage toImage​(javax.swing.Icon icon)
      Create an image from a given icon
      static byte[] toPng​(java.awt.image.RenderedImage img)
      Export given image to PNG.
      static byte[] toPng​(javax.swing.Icon icon)
      Export given icon to PNG.
      static byte[] toSvg​(javax.swing.Icon icon)
      Export given icon to SVG.
      • Methods inherited from class java.lang.Object

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

      • IMAGE_SHAPE_IMAGE_TYPES

        public static final java.util.List<java.lang.String> IMAGE_SHAPE_IMAGE_TYPES
    • Constructor Detail

      • IconUtilities

        public IconUtilities()
    • Method Detail

      • toSvg

        public static byte[] toSvg​(javax.swing.Icon icon)
        Export given icon to SVG.
        Parameters:
        icon - icon
        Returns:
        svg bytes
      • toPng

        public static byte[] toPng​(javax.swing.Icon icon)
        Export given icon to PNG.
        Parameters:
        icon - icon
        Returns:
        png bytes
      • toPng

        public static byte[] toPng​(java.awt.image.RenderedImage img)
        Export given image to PNG.
        Parameters:
        img - image
        Returns:
        png bytes
      • getGrayIcon

        @CheckForNull
        public static ResizableIcon getGrayIcon​(@CheckForNull
                                                javax.swing.Icon icon,
                                                java.awt.Component component)
        Returns gray(disabled) icon for a given one.
        Parameters:
        icon - the given icon
        component - component
        Returns:
        gray(disabled) icon
      • toImage

        public static java.awt.image.BufferedImage toImage​(javax.swing.Icon icon)
        Create an image from a given icon
        Parameters:
        icon - icon
        Returns:
        image
      • isImageFile

        public static boolean isImageFile​(java.io.File file)
      • isExistingIconImage

        public static boolean isExistingIconImage​(javax.swing.Icon icon)
        Used to check if icon really contains a valid image
        Parameters:
        icon - icon
        Returns:
        if icon image is valid