Class JColorIcon

  • All Implemented Interfaces:
    Icon

    public class JColorIcon
    extends Object
    implements Icon
    An Icon to display a color. Used by JSimpleStyleDialog.
    Since:
    2.6
    Author:
    Michael Bedward
    • Constructor Summary

      Constructors 
      Constructor Description
      JColorIcon​(int width, int height, Color color)
      Construtor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIconHeight()
      Get the icon's height
      int getIconWidth()
      Get the icon's width
      void paintIcon​(Component c, Graphics g, int x, int y)
      Paint the icon using the current color.
      void setColor​(Color color)
      Set the color
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JColorIcon

        public JColorIcon​(int width,
                          int height,
                          Color color)
        Construtor.
        Parameters:
        width - icon width
        height - icon height
        color - initial color
    • Method Detail

      • paintIcon

        public void paintIcon​(Component c,
                              Graphics g,
                              int x,
                              int y)
        Paint the icon using the current color. This method is invoked by the System.
        Specified by:
        paintIcon in interface Icon
        Parameters:
        c - arg presently ignored
        g - graphics object
        x - x position
        y - y position
      • getIconWidth

        public int getIconWidth()
        Get the icon's width
        Specified by:
        getIconWidth in interface Icon
        Returns:
        width in pixels
      • getIconHeight

        public int getIconHeight()
        Get the icon's height
        Specified by:
        getIconHeight in interface Icon
        Returns:
        height in pixels
      • setColor

        public void setColor​(Color color)
        Set the color
        Parameters:
        color - new color