public class ColorSwatch
extends java.lang.Object
implements javax.swing.Icon
ColorSwatch
class is an icon that shows a
rectangle of a given color.Constructor and Description |
---|
ColorSwatch(java.awt.Color color,
int width,
int height)
Create a new color swatch.
|
Modifier and Type | Method and Description |
---|---|
int |
getIconHeight()
Gets the icon height.
|
int |
getIconWidth()
Gets the icon width.
|
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paints the icon to the specified graphics context.
|
void |
setColor(java.awt.Color color)
Sets the swatch color.
|
public ColorSwatch(java.awt.Color color, int width, int height)
color
- the color to display.width
- the icon width.height
- the icon height.public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
public void setColor(java.awt.Color color)