Class RetinaImageIcon

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

    @OpenApiAll
    public class RetinaImageIcon
    extends ResizableIconImageIcon
    Retina friendly image icon implementation. Icon(and image returned by this icon) is twice smaller then the wrapped icon itself. Wrapped icon is used for painting. On paint Graphics is scaled down by retina scale factor and wrapped icon is painted.
    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 Detail

      • RetinaImageIcon

        public RetinaImageIcon​(ResizableIcon icon)
        Constructor. Scales down given icon by retina factor.
        Parameters:
        icon - given icon
      • RetinaImageIcon

        public RetinaImageIcon​(ResizableIcon icon,
                               int width,
                               int height)
        Constructor. Scales down given icon to the given width and height.
        Parameters:
        icon - given icon
      • RetinaImageIcon

        public RetinaImageIcon​(java.awt.Image image,
                               int width,
                               int height)
        Constructor. Scales down given icon to the given width and height.
        Parameters:
        image - given image
      • RetinaImageIcon

        public RetinaImageIcon​(java.awt.Image image)
        Constructor. Scales down given image by retina factor.
        Parameters:
        image - given image
    • Method Detail

      • paintIcon

        public void paintIcon​(@CheckForNull
                              java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y,
                              int w,
                              int h)
        Description copied from interface: ResizableIcon
        Draw the icon in the given bounds. Icon implementations may use the Component argument to get properties useful for painting, e.g. the foreground or background color.
        Specified by:
        paintIcon in interface ResizableIcon
        Overrides:
        paintIcon in class ScalableImageIcon
        Parameters:
        c - the given component.
        g - the graphics to paint on.
        x - x coordinate.
        y - y coordinate.
        w - width to paint.
        h - height to paint.
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon
        Overrides:
        paintIcon in class ScalableImageIcon
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
        Overrides:
        getIconWidth in class ScalableImageIcon
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
        Overrides:
        getIconHeight in class ScalableImageIcon