// Purpose: Displays a colored rectangle within a window.	
	
import javax.swing.*;	
import java.awt.*;	
	
public class ColoredRectangle {	
	// instance variables to describe object attributes	
	private int width;     // rectangle width	
	private int height;    // rectangle height	
	private int x;         // rectangle x-coordinate position	
	private int y;         // rectangle y-coordinate position	
	private JFrame window; // window displaying rectangle	
	private Color color;   // color of rectangle	
	
	// ColoredRectangle(): default constructor	
	public ColoredRectangle() {	
		window = new JFrame("Box Fun");	
		window.setSize(200, 200);	
	
		width = 40;	
		height = 20;	
		x = 80;	
		y = 90;	
	
		color = Color.BLUE;	
	
		window.setVisible(true);	
	}	
	
	// paint(): display the rectangle in its window	
	public void paint() {	
		Graphics g = window.getGraphics();	
		g.setColor(color);	
		g.fillRect(x, y, width, height);	
	}	
}	
