Package gov.nih.mipav.view
Class ColorIcon
- java.lang.Object
-
- gov.nih.mipav.model.structures.ModelSerialCloneable
-
- gov.nih.mipav.view.ColorIcon
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,javax.swing.Icon
public class ColorIcon extends ModelSerialCloneable implements javax.swing.Icon
This is an icon which is a block of color with bounds specified in the constructor. It is from Graphic Java Mastering the JFC Volume II: Swing, by David Geary, published by Sun Microsystems Press 1999, page 1085.- Version:
- 0.1 Aug 1, 1999
- Author:
- David Geary
- See Also:
ColorRenderer
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Color
color
DOCUMENT ME!static java.awt.Color
FOREGROUND
private int
h
DOCUMENT ME!static java.awt.Color
TRANSPARENT
private int
w
DOCUMENT ME!
-
Constructor Summary
Constructors Constructor Description ColorIcon()
Constructor Makes a color icon with the default color of gray and default width and height values of 50 and 15, respectively.ColorIcon(java.awt.Color color, int w, int h)
Constructor Makes a color icon with the specified color, width, and height.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.Color
getColor()
getColor - gets the color of the icon.int
getIconHeight()
getIconHeight - gets the height of the icon.int
getIconWidth()
getIconWidth - gets the width of the icon.void
paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon - paints the icon with a balck border.void
setColor(java.awt.Color color)
setColor - sets the color of the icon.void
setIconHeight(int h)
setIconHeight - sets the height of the icon.void
setIconWidth(int w)
setIconWidth - sets the width of the icon.-
Methods inherited from class gov.nih.mipav.model.structures.ModelSerialCloneable
clone, nativeClone
-
-
-
-
Constructor Detail
-
ColorIcon
public ColorIcon()
Constructor Makes a color icon with the default color of gray and default width and height values of 50 and 15, respectively.
-
ColorIcon
public ColorIcon(java.awt.Color color, int w, int h)
Constructor Makes a color icon with the specified color, width, and height.- Parameters:
color
- color to set the icon tow
- width to set the icon toh
- height to set the icon to
-
-
Method Detail
-
getColor
public java.awt.Color getColor()
getColor - gets the color of the icon.- Returns:
- color of the icon
-
getIconHeight
public int getIconHeight()
getIconHeight - gets the height of the icon.- Specified by:
getIconHeight
in interfacejavax.swing.Icon
- Returns:
- height of the icon
-
getIconWidth
public int getIconWidth()
getIconWidth - gets the width of the icon.- Specified by:
getIconWidth
in interfacejavax.swing.Icon
- Returns:
- width of the icon
-
paintIcon
public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon - paints the icon with a balck border.- Specified by:
paintIcon
in interfacejavax.swing.Icon
- Parameters:
c
- component to paintg
- graphics to paint inx
- beginning x-coordinatey
- beginning y-coordinate
-
setColor
public void setColor(java.awt.Color color)
setColor - sets the color of the icon.- Parameters:
color
- color of the icon
-
setIconHeight
public void setIconHeight(int h)
setIconHeight - sets the height of the icon.- Parameters:
h
- height of the icon
-
setIconWidth
public void setIconWidth(int w)
setIconWidth - sets the width of the icon.- Parameters:
w
- width of the icon
-
-