Documentation of 'smile.swing.AlphaIcon' Java class
AlphaIcon
smile.swing

Class AlphaIcon

  • All Implemented Interfaces:
    javax.swing.Icon


    public class AlphaIcon
    extends java.lang.Object
    implements javax.swing.Icon
    An Icon wrapper that paints the contained icon with a specified transparency.

    Note: This class is not suitable for wrapping an ImageIcon that holds an animated image.

    • Constructor Summary

      Constructors 
      Constructor and Description
      AlphaIcon(javax.swing.Icon icon, float alpha)
      Creates an AlphaIcon with the specified icon and opacity.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      float getAlpha()
      Gets this AlphaIcon's opacity
      javax.swing.Icon getIcon()
      Gets the icon wrapped by this AlphaIcon
      int getIconHeight()
      Gets the height of the bounding rectangle of this AlphaIcon.
      int getIconWidth()
      Gets the width of the bounding rectangle of this AlphaIcon.
      void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
      Paints the wrapped icon with this AlphaIcon's transparency.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlphaIcon

        public AlphaIcon(javax.swing.Icon icon,
                         float alpha)
        Creates an AlphaIcon with the specified icon and opacity. The opacity alpha should be in the range 0.0F (fully transparent) to 1.0F (fully opaque).
        Parameters:
        icon - the Icon to wrap
        alpha - the opacity
    • Method Detail

      • getAlpha

        public float getAlpha()
        Gets this AlphaIcon's opacity
        Returns:
        the opacity, in the range 0.0 to 1.0
      • getIcon

        public javax.swing.Icon getIcon()
        Gets the icon wrapped by this AlphaIcon
        Returns:
        the wrapped icon
      • paintIcon

        public void paintIcon(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Paints the wrapped icon with this AlphaIcon's transparency.
        Specified by:
        paintIcon in interface javax.swing.Icon
        Parameters:
        c - The component to which the icon is painted
        g - the graphics context
        x - the X coordinate of the icon's top-left corner
        y - the Y coordinate of the icon's top-left corner
      • getIconWidth

        public int getIconWidth()
        Gets the width of the bounding rectangle of this AlphaIcon. Returns the width of the wrapped icon.
        Specified by:
        getIconWidth in interface javax.swing.Icon
        Returns:
        the width in pixels
      • getIconHeight

        public int getIconHeight()
        Gets the height of the bounding rectangle of this AlphaIcon. * Returns the height of the wrapped icon.
        Specified by:
        getIconHeight in interface javax.swing.Icon
        Returns:
        the height in pixels

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.