import java.awt.*;
import java.awt.datatransfer.*;

public class ProtoFigure extends Figure
{
    public ProtoFigure(Image im)
    {
	myAnchor = new Point(10,10);    // this should change
	myImage = im;
	myDim    = new
	    Dimension(im.getWidth(this),im.getHeight(this));
	
    }

    public void paint(Graphics g)
    {
	g.drawImage(myImage,0,0,myDim.width,myDim.height,this);
    }

    public Dimension getPreferredSize()
    {
	return myDim;
    }
    
    public void setLocation(Point p)
    {
	myAnchor = p;
	super.setLocation(p);
    }
    
    public Rectangle getBounds()
    {
	return new
	    Rectangle(myAnchor.x,myAnchor.y,myDim.width,myDim.height);
    }

    public Object clone()
    {
	return new ProtoFigure(myImage);
    }

    public String toString()
    {
	return super.toString()+" "+Integer.toString(myNumber);
    }

    public boolean contains(Point p)
    {
	return myAnchor.x <= p.x && p.x <= myAnchor.x + myDim.width &&
	       myAnchor.y <= p.y && p.y <= myAnchor.y + myDim.height;
    }
    
    Point      myAnchor;
    Image      myImage;
    Dimension  myDim;
    int        myNumber = ourCount++;
    static int ourCount = 0;
}
