Class IconUtilities

java.lang.Object
com.nomagic.ui.IconUtilities

@OpenApiAll public class IconUtilities extends Object
Utility class to work wih Icons
  • Field Details

    • IMAGE_SHAPE_IMAGE_TYPES

      public static final List<String> IMAGE_SHAPE_IMAGE_TYPES
  • Constructor Details

    • IconUtilities

      public IconUtilities()
  • Method Details

    • toSvg

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

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

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

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

      public static BufferedImage toImage(Icon icon)
      Create an image from a given icon
      Parameters:
      icon - icon
      Returns:
      image
    • isImageFile

      public static boolean isImageFile(File file)
    • isExistingIconImage

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