public final class ColorLabelDecorator
extends javax.swing.ImageIcon
ColorLabelDecorator
class provides a label decorator for a menu item showing a colour.
Note that this class cannot be subclassed!
Constructor and Description |
---|
ColorLabelDecorator()
Constructs a
ColorLabelDecorator object with a default black colour. |
ColorLabelDecorator(java.awt.Color color)
Constructs a
ColorLabelDecorator object with a specified colour. |
Modifier and Type | Method and Description |
---|---|
int |
getIconHeight()
Returns the icon's height.
|
int |
getIconWidth()
Returns the icon's width.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the icon.
|
void |
setColor(java.awt.Color color)
Sets the colour.
|
public ColorLabelDecorator()
ColorLabelDecorator
object with a default black colour.public ColorLabelDecorator(java.awt.Color color)
ColorLabelDecorator
object with a specified colour.color
- the colour to copypublic int getIconHeight()
getIconHeight
in interface javax.swing.Icon
getIconHeight
in class javax.swing.ImageIcon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
getIconWidth
in class javax.swing.ImageIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
paintIcon
in class javax.swing.ImageIcon
c
- the component to be used as the observer if this icon has no image observerg
- the graphics contextx
- the X coordinate of the icon's top-left cornery
- the Y coordinate of the icon's top-left cornerpublic void setColor(java.awt.Color color)
color
- the colour