import java.awt.*;
import java.awt.image.*;
import java.io.*;
import java.util.*;
import javax.imageio.*;

/**
 * Class ColoredRectangle extends Rectangle to print a colored box.
 *
 * @author McKinley
 * @version April 2007
 *
 * 1) Declare the class
 * 2) Add an instance variable
 * 3) Add a default constructor
 * 4) Add other 2 constructors (w,h) & (w,h,c)
 * 5) Add getColor
 * 6) Override Rectangle.draw
 * 7) Uncomment and discuss main, note two mains (top one is ColoredRectangle)
 * 8) Try some more things in main of ColoredRectangle
 *
 */
public class ColoredRectangle extends Rectangle {

    private Color myColor;

    public ColoredRectangle() {
        super();
        myColor = Color.red;
    }

    public ColoredRectangle(int w, int h) {
        super(w, h);
        myColor = Color.blue;
    }

    public ColoredRectangle(int w, int h, Color c) {
        super(w, h);
        myColor = c;
    }

    public Color getColor() {
        return myColor;
    }

    public void draw(DrawingBox box, int x, int y) {
        box.setColor(myColor);
		box.fillRect(x, y, width, height);
    }


    public static void main (String [] args)
    {
        DrawingBox box = new DrawingBox();
        Rectangle colorless = new Rectangle(100, 50);
        ColoredRectangle r = new ColoredRectangle(250,150,Color.pink);
        ColoredRectangle r2 = new ColoredRectangle(250,200);

        r.draw(box, 10, 10);
        colorless.draw(box, 10, 300);
        r2.draw(box, 300,300);

    }
}
