Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python
C++

JAVA


PHP
SQL
Alice

DrawingExample


Description

Run it
Download jar file (Right click)

BasicShape.java
BasicString.java
DrawingExample.java
DrawingPanel.java
GraphicalObject.java
Oval.java
Rectangle.java
SizedObject.java

Rectangle.java

import java.awt.*;

/**
 * Write a description of class Rectangle here.
 * 
 * @author Chuck Cusack
 * @version 1.0, September, 2005
 */
public class Rectangle extends BasicShape
{
    public Rectangle() {
      super();
    }
	public Rectangle(int x, int y, int width, int height,
	                       Color color, boolean isFilled) {
	    super(x,y,width,height,color,isFilled);
	}
    /**
     * Overriding the drawFilledShape method from BasicShapes
     * so we can draw our filled rectangle.
     */
	public void drawFilledShape(Graphics g) {
	    g.fillRect(x,y,width,height);
	}
    /**
     * Overriding the drawFilledShape method from BasicShapes
     * so we can draw our hollow rectangle.
     */
	public void drawHollowShape(Graphics g) {
	    g.drawRect(x,y,width,height);
	}
}