
/**
 * Rectangle.java
 *
 *
 * Created: Tue Dec 18 04:46:55 2001
 *
 * @author <a href="mailto: "Jan Newmarch</a>
 * @version
 */

package saver.drawable;

import java.awt.*;

public class Rect extends Drawable{
    
    protected static Color[] colors = {Color.red, Color.blue, Color.green, Color.yellow};
    protected Color color;

    public Rect() {
	int index = (int) Math.floor(Math.random() * colors.length);
	color = colors[index];
	setSize(20, 20);
    }

    public Rect(Rect orig) {
	super(orig);
	this.color = orig.color;
    }

    public void paint(Graphics g) {
	g.setColor(color);
	g.fillRect(0, 0, this.getWidth(), this.getHeight());
    }

    public Drawable copy() {
	Rect copy = new Rect(this);
	copy.color = color;
	return copy;
    }
}// Rect
