Class ColorIcon

All Implemented Interfaces:
Serializable, Cloneable, Icon

public class ColorIcon extends ModelSerialCloneable implements 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:
  • Field Details

    • TRANSPARENT

      public static final Color TRANSPARENT
    • FOREGROUND

      public static final Color FOREGROUND
    • color

      private Color color
      DOCUMENT ME!
    • w

      private int w
      DOCUMENT ME!
    • h

      private int h
      DOCUMENT ME!
  • Constructor Details

    • 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(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 to
      w - width to set the icon to
      h - height to set the icon to
  • Method Details

    • getColor

      public 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 interface Icon
      Returns:
      height of the icon
    • getIconWidth

      public int getIconWidth()
      getIconWidth - gets the width of the icon.
      Specified by:
      getIconWidth in interface Icon
      Returns:
      width of the icon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      paintIcon - paints the icon with a balck border.
      Specified by:
      paintIcon in interface Icon
      Parameters:
      c - component to paint
      g - graphics to paint in
      x - beginning x-coordinate
      y - beginning y-coordinate
    • setColor

      public void setColor(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