import java.awt.*;
import java.awt.geom.*;

public class Sample3 extends ToyGraphics {
    public Sample3() { super(640, 360); }
    public void run() {
	g2d.setPaint(Color.black);
	g2d.fill(new Rectangle2D.Double(0, 0, width, height));  // ウィンドウ全体を黒で塗りつぶす

	drawRect(50,50,200,100,255,0,0);
	drawRect(100,80,200,100,0,255,255);
    }
    void drawRect(int x,int y,int w,int h,int r,int g,int b) {
	for (int line=y; line < y+h; line++) {
	    for (int col=x; col < x+w; col++) {
		setRGB(col,line,r,g,b);
	    }
	}
	repaint(x,y,w,h);
    }
    public static void main(String[] args) {
	Sample3 app = new Sample3();
	app.run();
    }
}
