public class ColorSwatch extends Object implements Icon
Modifier and Type | Field and Description |
---|---|
private Color |
color |
static Color |
DEFAULT_COLOR
The default swatch color.
|
static int |
DEFAULT_HEIGHT
The default swatch height.
|
static int |
DEFAULT_WIDTH
The default swatch width.
|
private int |
h |
private int |
w |
Constructor and Description |
---|
ColorSwatch()
Construct a new
ColorSwatch with a default color, width,
and height. |
ColorSwatch(Color color,
int width,
int height)
Construct a new
ColorSwatch with the specified color and
geometry. |
Modifier and Type | Method and Description |
---|---|
Color |
getColor()
Get the color of this swatch.
|
int |
getIconHeight()
Get the height of the swatch.
|
int |
getIconWidth()
Get the width of the swatch.
|
void |
paintIcon(Component c,
Graphics gc,
int x,
int y)
Paint the swatch (as an icon).
|
void |
setColor(Color color)
Set the color of this swatch.
|
private int w
private int h
public static final int DEFAULT_WIDTH
public static final int DEFAULT_HEIGHT
public static final Color DEFAULT_COLOR
public ColorSwatch()
ColorSwatch
with a default color, width,
and height.public ColorSwatch(Color color, int width, int height)
ColorSwatch
with the specified color and
geometry.color
- The color for the swatch.width
- The width, in pixels.height
- The height, in pixels.public Color getColor()
public void setColor(Color color)
color
- The new color for the swatch.public int getIconWidth()
getIconWidth
in interface Icon
public int getIconHeight()
getIconHeight
in interface Icon
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses