org.opensourcephysics.display
Class ColorIcon

java.lang.Object
  extended by org.opensourcephysics.display.ColorIcon
All Implemented Interfaces:
javax.swing.Icon

public class ColorIcon
extends java.lang.Object
implements javax.swing.Icon

This Icon fills itself with the color specified in its constructor.

Author:
Douglas Brown

Constructor Summary
ColorIcon(java.awt.Color color, int width, int height)
          Constructs a ColorIcon.
 
Method Summary
 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.
 void setColor(java.awt.Color color)
          Sets the color.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorIcon

public ColorIcon(java.awt.Color color,
                 int width,
                 int height)
Constructs a ColorIcon.

Parameters:
color - color of the icon
width - width of the icon
height - height of the icon
Method Detail

setColor

public void setColor(java.awt.Color color)
Sets the color.

Parameters:
color - the desired color

getIconWidth

public int getIconWidth()
Gets the icon width.

Specified by:
getIconWidth in interface javax.swing.Icon
Returns:
the icon width

getIconHeight

public int getIconHeight()
Gets the icon height.

Specified by:
getIconHeight in interface javax.swing.Icon
Returns:
the icon height

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics _g,
                      int x,
                      int y)
Paints the icon.

Specified by:
paintIcon in interface javax.swing.Icon
Parameters:
c - the component on which it is painted
_g - the graphics context
x - the x coordinate of the icon
y - the y coordinate of the icon