Class SvgIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class SvgIcon
    extends java.lang.Object
    implements javax.swing.Icon
    A Swing Icon that draws an SVG image.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected class  SvgIcon.BufferedImageTranscoder
      A transcoder that generates a BufferedImage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.awt.image.BufferedImage bufferedImage
      The BufferedImage generated from the SVG document.
      protected java.awt.Image bufferedImageDisabled  
      protected int height
      The height of the rendered image.
      protected int width
      The width of the rendered image.
    • Constructor Summary

      Constructors 
      Constructor Description
      SvgIcon​(java.net.URL url)
      Create a new SVGIcon object.
      SvgIcon​(java.net.URL url, int width, int height)
      Create a new SVGIcon object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void generateBufferedImage​(org.apache.batik.transcoder.TranscoderInput in, int w, int h)
      Generate the BufferedImage.
      int getIconHeight()
      Returns the icon's height.
      int getIconWidth()
      Returns the icon's width.
      void paintIcon​(java.awt.Component c, java.awt.Graphics g, int x, int y)
      Draw the icon at the specified location.
      • Methods inherited from class java.lang.Object

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

      • bufferedImage

        protected java.awt.image.BufferedImage bufferedImage
        The BufferedImage generated from the SVG document.
      • bufferedImageDisabled

        protected java.awt.Image bufferedImageDisabled
      • width

        protected int width
        The width of the rendered image.
      • height

        protected int height
        The height of the rendered image.
    • Constructor Detail

      • SvgIcon

        public SvgIcon​(java.net.URL url,
                       int width,
                       int height)
        Create a new SVGIcon object.
        Parameters:
        uri - The URI to read the SVG document from.
      • SvgIcon

        public SvgIcon​(java.net.URL url)
        Create a new SVGIcon object.
        Parameters:
        uri - The URI to read the SVG document from.
    • Method Detail

      • generateBufferedImage

        protected void generateBufferedImage​(org.apache.batik.transcoder.TranscoderInput in,
                                             int w,
                                             int h)
                                      throws org.apache.batik.transcoder.TranscoderException
        Generate the BufferedImage.
        Throws:
        org.apache.batik.transcoder.TranscoderException
      • getIconWidth

        public int getIconWidth()
        Returns the icon's width.
        Specified by:
        getIconWidth in interface javax.swing.Icon
      • getIconHeight

        public int getIconHeight()
        Returns the icon's height.
        Specified by:
        getIconHeight in interface javax.swing.Icon
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Draw the icon at the specified location.
        Specified by:
        paintIcon in interface javax.swing.Icon