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