public class AlphaIcon
extends java.lang.Object
implements javax.swing.Icon
Note: This class is not suitable for wrapping an
ImageIcon that holds an animated image.
| Constructor and Description |
|---|
AlphaIcon(javax.swing.Icon icon,
float alpha)
Creates an
AlphaIcon with the specified icon and opacity. |
| 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. |
public AlphaIcon(javax.swing.Icon icon,
float alpha)
AlphaIcon with the specified icon and opacity. The opacity
alpha should be in the range 0.0F (fully transparent) to
1.0F (fully opaque).icon - the Icon to wrapalpha - the opacitypublic float getAlpha()
AlphaIcon's opacitypublic javax.swing.Icon getIcon()
AlphaIconpublic void paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
AlphaIcon's transparency.paintIcon in interface javax.swing.Iconc - The component to which the icon is paintedg - the graphics contextx - the X coordinate of the icon's top-left cornery - the Y coordinate of the icon's top-left cornerpublic int getIconWidth()
AlphaIcon. Returns the width of the wrapped icon.getIconWidth in interface javax.swing.Iconpublic int getIconHeight()
AlphaIcon. * Returns the height of the wrapped icon.getIconHeight in interface javax.swing.Icon