Class ColorSwatch

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible


    public class ColorSwatch
    extends JPanel
    This is a square, opaque panel used to indicate a certain color.

    The color is assigned with the setForeground() method.

    Also the user can right-click this panel and select 'Copy' to send a 100x100 image of this color to the clipboard. (This feature was added at the request of a friend who paints; she wanted to select a color and then quickly print it off, and then mix her paints to match that shade.)

    new com.bric.swing.ColorSwatch( java.awt.Color.blue, 50 )

    See Also:
    Serialized Form
    • Field Detail

      • PROPERTY_COPY_CONTEXTUAL_MENU_ITEM

        public static final String PROPERTY_COPY_CONTEXTUAL_MENU_ITEM
        If this client property maps to true, then a "Copy" menu item will be available in a contextual menu. The default value for this key is assumed to be false if undefined.
    • Constructor Detail

      • ColorSwatch

        public ColorSwatch(int width)
      • ColorSwatch

        public ColorSwatch(Color color,
                           int width)
    • Method Detail

      • updateContextualMenu

        protected void updateContextualMenu()
      • paint

        public void paint(Graphics g0)