Class FigureIcon

  • All Implemented Interfaces:
    java.io.Serializable, javax.accessibility.Accessible, javax.swing.Icon

    public class FigureIcon
    extends javax.swing.ImageIcon
    An icon that looks like a diva figure. This class renders the figure into a buffered image and then points the icon at the buffer. This process is rather slow, so you might want to cache the returned icon somehow to avoid repeating it, especially if you have a large number of icons to render such as in a TreeCellRenderer. This class handles ImageFigure specially, to deal with image loading. Where possible, instead of painting the figure into a buffered image, this class simply uses the Image of an ImageFigure.
    Version:
    $Id$
    Author:
    Steve Neuendorffer
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.ImageIcon

        javax.swing.ImageIcon.AccessibleImageIcon
    • Field Summary

      • Fields inherited from class javax.swing.ImageIcon

        component, tracker
    • Constructor Summary

      Constructors 
      Constructor Description
      FigureIcon​(Figure figure)
      Create a new icon that looks like the given figure.
      FigureIcon​(Figure figure, boolean antialias)
      Create a new icon that looks like the given figure.
      FigureIcon​(Figure figure, int x, int y)
      Create a new icon that looks like the given figure.
      FigureIcon​(Figure figure, int x, int y, int border, boolean antialias)
      Create a new icon that looks like the given figure.
    • Method Summary

      • Methods inherited from class javax.swing.ImageIcon

        getAccessibleContext, getDescription, getIconHeight, getIconWidth, getImage, getImageLoadStatus, getImageObserver, loadImage, paintIcon, setDescription, setImage, setImageObserver, toString
      • Methods inherited from class java.lang.Object

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

      • FigureIcon

        public FigureIcon​(Figure figure)
        Create a new icon that looks like the given figure. The icon will have the size of the bounds of the figure. The figure will be rendered into the icon with antialiasing turned off.
      • FigureIcon

        public FigureIcon​(Figure figure,
                          boolean antialias)
        Create a new icon that looks like the given figure. The icon will have the size of the bounds of the figure. The figure will be rendered into the icon with antialiasing according to the given flag.
        Parameters:
        antialias - True if antialiasing should be used.
      • FigureIcon

        public FigureIcon​(Figure figure,
                          int x,
                          int y)
        Create a new icon that looks like the given figure. The figure will be scaled to fit inside the given size, with any excess size filled with a transparent background color. The figure will be rendered into the icon with antialiasing turned off.
      • FigureIcon

        public FigureIcon​(Figure figure,
                          int x,
                          int y,
                          int border,
                          boolean antialias)
        Create a new icon that looks like the given figure. The icon will be made the given size, and given a border of the given number of pixels. The rendition of the figure will be scaled to fit inside the border, with any excess size filled with a transparent background color. The figure will be rendered into the icon with antialiasing according to the given flag.
        Parameters:
        antialias - True if antialiasing should be used.