Class ColorSwatch

java.lang.Object
noaa.coastwatch.gui.visual.ColorSwatch
All Implemented Interfaces:
Icon

public class ColorSwatch extends Object implements Icon
The ColorSwatch class is an icon that shows a rectangle of a given color.
Since:
3.1.7
Author:
Peter Hollemans
  • Constructor Details

    • ColorSwatch

      public ColorSwatch(Color color, int width, int height)
      Create a new color swatch.
      Parameters:
      color - the color to display.
      width - the icon width.
      height - the icon height.
  • Method Details

    • getIconWidth

      public int getIconWidth()
      Gets the icon width.
      Specified by:
      getIconWidth in interface Icon
    • getIconHeight

      public int getIconHeight()
      Gets the icon height.
      Specified by:
      getIconHeight in interface Icon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Paints the icon to the specified graphics context.
      Specified by:
      paintIcon in interface Icon
    • setColor

      public void setColor(Color color)
      Sets the swatch color.