Rectangle

Rectangle - theCanvas canvas = theCanvas lowerLeftX = llX lowerLeftY = llY length = theLength height = theHeight public void draw

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.awt.Graphics; public class Rectangle { // Data members protected int lowerLeftX, lowerLeftY; // Coordinates of lower left corner protected int height, length; protected Graphics canvas; public Rectangle(Graphics theCanvas) { canvas = theCanvas; } public Rectangle(int llX, int llY, int theLength, int theHeight, Graphics
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: theCanvas ) { canvas = theCanvas; lowerLeftX = llX; lowerLeftY = llY; length = theLength; height = theHeight; } public void draw() { canvas.drawRect(lowerLeftX, lowerLeftY, length, height); } public void erase() { canvas.clearRect(lowerLeftX, lowerLeftY, length, height); } }...
View Full Document

This note was uploaded on 06/10/2011 for the course COMP 110 taught by Professor Stotts during the Spring '08 term at UNC.

Ask a homework question - tutors are online