public class WashedIcon
extends java.lang.Object
implements javax.swing.Icon
Icon
interface that can render another
icon in a faded, or washed-out, state. The level of fading can be
controlled by specifying the alpha level to be used for rendering; if no
level of fading is specified, a default level is used.Modifier and Type | Field and Description |
---|---|
protected static float |
DEFAULT_ALPHA
The default alpha level to use for rendering.
|
Constructor and Description |
---|
WashedIcon(javax.swing.Icon icon)
Creates a washed-out icon from another icon, using a default level of
fading.
|
WashedIcon(javax.swing.Icon icon,
float alpha)
Creates a washed-out icon from another icon, using the specified level
of fading.
|
Modifier and Type | Method and Description |
---|---|
float |
getAlpha()
Gets the alpha level to use for rendering.
|
protected java.awt.AlphaComposite |
getComposite()
Gets the
AlphaComposite to use for rendering. |
javax.swing.Icon |
getIcon()
Gets the original source
Icon to use for rendering. |
int |
getIconHeight() |
int |
getIconWidth() |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y) |
protected static final float DEFAULT_ALPHA
public WashedIcon(javax.swing.Icon icon)
icon
- the icon image to displaypublic WashedIcon(javax.swing.Icon icon, float alpha)
icon
- the icon image to displayalpha
- the alpha value to use for rendering, in the range of
[0.0, 1.0]. An alpha of 1.0 is completely opaque, and an
alpha of 0.0 is completely transparent.public javax.swing.Icon getIcon()
Icon
to use for rendering.public float getAlpha()
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
protected java.awt.AlphaComposite getComposite()
AlphaComposite
to use for rendering.