|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjavax.swing.ImageIcon
com.wordpress.tipsforjava.swing.AlphaImageIcon
public class AlphaImageIcon extends ImageIcon
An Icon wrapper that paints the contained icon with a specified transparency.
This class is suitable for wrapping an ImageIcon
that holds an animated image. To show a non-animated Icon with transparency,
the companion class AlphaIcon is a lighter alternative.
| Field Summary | |
|---|---|
private float |
alpha
|
private Icon |
icon
|
private Image |
image
|
| Constructor Summary | |
AlphaImageIcon(Icon icon, float alpha)
Creates an |
|
| Method Summary | |
|---|---|
float
|
getAlpha()
Gets this |
Icon
|
getIcon()
Gets the icon wrapped by this |
int
|
getIconHeight()
Gets the height of the bounding rectangle of this |
int
|
getIconWidth()
Gets the width of the bounding rectangle of this |
Image
|
getImage()
Overridden to return the image of a wrapped ImageIcon, or null if the wrapped icon is not an ImageIcon. |
int
|
getImageLoadStatus()
Overridden to return the status of the image loading operation of a wrapped ImageIcon, or 0 if the contained icon is not an ImageIcon. |
ImageObserver
|
getImageObserver()
Overridden to return the ImageObserver of the image of a wrapped ImageIcon, or null if the contained icon is not an ImageIcon. |
void
|
paintIcon(Component c, Graphics g, int x, int y)
Paints the wrapped icon with this |
void
|
setImage(Image image)
Overridden to forward to a wrapped ImageIcon. |
void
|
setImageObserver(ImageObserver observer)
Overridden to forward to a wrapped ImageIcon. |
| Methods inherited from class ImageIcon | |
|---|---|
| toString, getDescription, getAccessibleContext, getIconWidth, getIconHeight, setDescription, getImage, paintIcon, getImageLoadStatus, setImage, setImageObserver, getImageObserver, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private float alpha
private Icon icon
private Image image
| Constructor Detail |
|---|
public AlphaImageIcon(Icon icon, float alpha)
AlphaImageIcon 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 opacity
| Method Detail |
|---|
public float getAlpha()
AlphaIcon's opacity
public Icon getIcon()
AlphaIcon
@Override public int getIconHeight()
AlphaImageIcon.
Overridden to return the height of the wrapped icon.
@Override public int getIconWidth()
AlphaImageIcon.
Overridden to return the width of the wrapped icom.
@Override public Image getImage()
@Override public int getImageLoadStatus()
@Override public ImageObserver getImageObserver()
@Override public void paintIcon(Component c, Graphics g, int x, int y)
AlphaImageIcon's transparency.
c - 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 corner
@Override public void setImage(Image image)
In common with ImageIcom, the newly set image will only be shown when the
concerned component(s) are repainted.
image - Sets the image displayed by a wrapped ImageIcon
@Override public void setImageObserver(ImageObserver observer)
observer - the image observer
Groovy Documentation