org.jhotdraw.draw.action
Class SelectionColorIcon

java.lang.Object
  extended by javax.swing.ImageIcon
      extended by org.jhotdraw.draw.action.SelectionColorIcon
All Implemented Interfaces:
java.io.Serializable, javax.accessibility.Accessible, javax.swing.Icon

public class SelectionColorIcon
extends javax.swing.ImageIcon

SelectionColorIcon draws a shape with the specified color for the selected figures in the current drawing view. If now figures are selcted, the specified color is taken from the DrawingEditor.

The behavior for choosing the drawn color matches with SelectionColorChooserAction.

Version:
$Id: SelectionColorIcon.java 564 2009-10-10 10:21:01Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.ImageIcon
javax.swing.ImageIcon.AccessibleImageIcon
 
Field Summary
private  java.awt.Shape colorShape
           
private  DrawingEditor editor
           
private  AttributeKey<java.awt.Color> key
           
 
Fields inherited from class javax.swing.ImageIcon
component, tracker
 
Constructor Summary
SelectionColorIcon(DrawingEditor editor, AttributeKey<java.awt.Color> key, java.awt.Image image, java.awt.Shape colorShape)
           
SelectionColorIcon(DrawingEditor editor, AttributeKey<java.awt.Color> key, java.net.URL imageLocation, java.awt.Shape colorShape)
          Creates a new instance.
 
Method Summary
 void paintIcon(java.awt.Component c, java.awt.Graphics gr, int x, int y)
           
 
Methods inherited from class javax.swing.ImageIcon
getAccessibleContext, getDescription, getIconHeight, getIconWidth, getImage, getImageLoadStatus, getImageObserver, loadImage, setDescription, setImage, setImageObserver, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

editor

private DrawingEditor editor

key

private AttributeKey<java.awt.Color> key

colorShape

private java.awt.Shape colorShape
Constructor Detail

SelectionColorIcon

public SelectionColorIcon(DrawingEditor editor,
                          AttributeKey<java.awt.Color> key,
                          java.net.URL imageLocation,
                          java.awt.Shape colorShape)
Creates a new instance.

Parameters:
editor - The drawing editor.
key - The key of the default attribute
imageLocation - the icon image
colorShape - The shape to be drawn with the color of the default attribute.

SelectionColorIcon

public SelectionColorIcon(DrawingEditor editor,
                          AttributeKey<java.awt.Color> key,
                          java.awt.Image image,
                          java.awt.Shape colorShape)
Method Detail

paintIcon

public void paintIcon(java.awt.Component c,
                      java.awt.Graphics gr,
                      int x,
                      int y)
Specified by:
paintIcon in interface javax.swing.Icon
Overrides:
paintIcon in class javax.swing.ImageIcon