101
Sh
shapesaver / files
shapesaver / MyRectangle.java
962 bytes
1/* 2sean caetano martin 3seancaetanomartin@gmail.com 4CIS 255 HY 5MyRectangle.java - rectangle shape creation for draw panel 6assignment#5 73/28/11 8*/ 9 10import java.awt.Color; 11import java.awt.Graphics; 12import java.util.Random; 13 14public class MyRectangle extends MyBoundedShape 15{ 16 // random object for radial draw 17 private Random randomNumbers = new Random(); 18 19 // super default constructor call 20 public MyRectangle () 21 { 22 super(); 23 } 24 25 // super constructor call 26 public MyRectangle (int x1, int y1, int x2, int y2, Color color, Boolean filled) 27 { 28 super(x1,x2,y1,y2,color,filled); 29 } 30 31 //draw override 32 @Override 33 public void draw (Graphics g) 34 { 35 g.setColor(getColor()); 36 37 if (isFilled()) 38 { 39 g.fillRect(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight()); 40 } 41 else 42 { 43 g.drawRect(getUpperLeftX(), getUpperLeftY(), getWidth(),getHeight()); 44 }// end else 45 }// end draw 46}// and MyRectangle