public class DecoratedIcon
extends java.lang.Object
implements javax.swing.Icon
Icon
that can have arbitrary decorative
icons attached to it. The decorations are grouped into 3 layers
that are painted on top of each other so that icons in the higher
layers obscure those in lower ones.
Note that this class is not thread-safe since all modifications should occur on the event dispatch thread only!
Modifier and Type | Field and Description |
---|---|
static int |
BACKGROUND_LAYER |
static int |
DEFAULT_LAYER |
static int |
OVERLAY_LAYER |
Constructor and Description |
---|
DecoratedIcon(javax.swing.Icon baseIcon) |
DecoratedIcon(javax.swing.Icon baseIcon,
int width,
int height) |
Modifier and Type | Method and Description |
---|---|
void |
addBackgroundDecoration(javax.swing.Icon icon,
int x,
int y) |
void |
addDecoration(javax.swing.Icon icon,
int alignment) |
void |
addDecoration(javax.swing.Icon icon,
int x,
int y) |
void |
addDecoration(int layer,
javax.swing.Icon icon,
int x,
int y) |
void |
addOverlayDecoration(javax.swing.Icon icon,
int x,
int y) |
int |
getIconHeight() |
int |
getIconWidth() |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y) |
void |
removeDecoration(javax.swing.Icon icon,
int alignment) |
void |
removeDecoration(int layer,
javax.swing.Icon icon,
int x,
int y) |
void |
removeDecorations() |
void |
removeDecorations(int layer) |
void |
setBaseIcon(javax.swing.Icon baseIcon) |
void |
setMaxSize(int width,
int height) |
public static final int BACKGROUND_LAYER
public static final int DEFAULT_LAYER
public static final int OVERLAY_LAYER
public DecoratedIcon(javax.swing.Icon baseIcon)
public DecoratedIcon(javax.swing.Icon baseIcon, int width, int height)
public void setBaseIcon(javax.swing.Icon baseIcon)
public void setMaxSize(int width, int height)
public void addBackgroundDecoration(javax.swing.Icon icon, int x, int y)
public void addOverlayDecoration(javax.swing.Icon icon, int x, int y)
public void addDecoration(javax.swing.Icon icon, int x, int y)
public void addDecoration(javax.swing.Icon icon, int alignment)
public void addDecoration(int layer, javax.swing.Icon icon, int x, int y)
public void removeDecoration(javax.swing.Icon icon, int alignment)
public void removeDecoration(int layer, javax.swing.Icon icon, int x, int y)
public void removeDecorations(int layer)
public void removeDecorations()
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
Icon.paintIcon(java.awt.Component, java.awt.Graphics, int, int)
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
Icon.getIconWidth()
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
Icon.getIconHeight()