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 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