Class ColorIcon

  • All Implemented Interfaces:
    javax.swing.Icon

    public class ColorIcon
    extends java.lang.Object
    implements javax.swing.Icon
    An icon that displays a rectangular Color.

    Version:
    $Revision: 1.7 $
    Author:
    Achim Westermann
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorIcon​(java.awt.Color color)
      Creates an icon with the given color.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.awt.Color getColor()
      Returns the color of this icon.
      int getIconHeight()  
      int getIconWidth()  
      int hashCode()  
      void paintIcon​(java.awt.Component c, java.awt.Graphics g, int x, int y)  
      void setColor​(java.awt.Color color)
      Sets the color of this icon.
      • Methods inherited from class java.lang.Object

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

      • ColorIcon

        public ColorIcon​(java.awt.Color color)
        Creates an icon with the given color.

        Parameters:
        color - the color of this icon.
    • Method Detail

      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
        See Also:
        Object.equals(java.lang.Object)
      • getColor

        public final java.awt.Color getColor()
        Returns the color of this icon.

        Returns:
        the color of this icon.
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface javax.swing.Icon
        See Also:
        Icon.getIconHeight()
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface javax.swing.Icon
        See Also:
        Icon.getIconWidth()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        Object.hashCode()
      • paintIcon

        public void paintIcon​(java.awt.Component c,
                              java.awt.Graphics g,
                              int x,
                              int y)
        Specified by:
        paintIcon in interface javax.swing.Icon
        See Also:
        Icon.paintIcon(java.awt.Component, java.awt.Graphics, int, int)
      • setColor

        public final void setColor​(java.awt.Color color)
        Sets the color of this icon.

        Parameters:
        color - The color of this icon to set.