package primitives.frames;
import java.awt.*;
/**
*A class which draws a 3D square around a CanvasArea.
@author Dori Eldar
*/
public class DrawFrame extends Panel {
	/**
	*A canvas which contains most of the area this object;
	*@see CanvasArea
	*/
	public CanvasArea drawArea;
	/**
	*initialize the panel with a CanvasArea member.
	*/
    public DrawFrame() {
        super();
        setLayout(new GridLayout(1,0));
		drawArea = new CanvasArea();
        add(drawArea);
        validate();
    }
	/**
	*@return Insets
	*/
    public Insets getInsets() {
        return new Insets(4,4,5,5);
    }
	/**
	*Draws a 3D square as the border of this Panel.
	*@param g a Graphic object to draw on.
	*/
    public void paint(Graphics g) {
        Dimension d = getSize();
        g.setColor(Color.gray);
        g.draw3DRect(0, 0, d.width - 1, d.height - 1, true);
        g.draw3DRect(3, 3, d.width - 7, d.height - 7, false);
    }
	/**
	*sets drawArea member to null.
	*@exception java.lang.Throwable .
	*/
	public void finalize() throws Throwable{
		drawArea = null;
	}
}
