Package smile.swing
Class AlphaIcon
java.lang.Object
smile.swing.AlphaIcon
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionfloatgetAlpha()Gets thisAlphaIcon's opacitygetIcon()Gets the icon wrapped by thisAlphaIconintGets the height of the bounding rectangle of thisAlphaIcon.intGets the width of the bounding rectangle of thisAlphaIcon.voidPaints the wrapped icon with thisAlphaIcon's transparency.
-
Constructor Details
-
AlphaIcon
Creates anAlphaIconwith the specified icon and opacity. The opacityalphashould be in the range 0.0F (fully transparent) to 1.0F (fully opaque).- Parameters:
icon- the Icon to wrapalpha- the opacity
-
-
Method Details
-
getAlpha
public float getAlpha()Gets thisAlphaIcon's opacity- Returns:
- the opacity, in the range 0.0 to 1.0
-
getIcon
Gets the icon wrapped by thisAlphaIcon- Returns:
- the wrapped icon
-
paintIcon
Paints the wrapped icon with thisAlphaIcon's transparency. -
getIconWidth
public int getIconWidth()Gets the width of the bounding rectangle of thisAlphaIcon. Returns the width of the wrapped icon.- Specified by:
getIconWidthin interfaceIcon- Returns:
- the width in pixels
-
getIconHeight
public int getIconHeight()Gets the height of the bounding rectangle of thisAlphaIcon. * Returns the height of the wrapped icon.- Specified by:
getIconHeightin interfaceIcon- Returns:
- the height in pixels
-