1 /* 2 * File: DrawableOval.java 3 * 4 * An oval class 5 * 6 * Copyright: Northeast Parallel Architectures Center 7 * 8 */ 9 10 import java.awt.*; 11 12 public class DrawableOval extends DrawableRectangle { 13 14 public DrawableOval( int new_x1, int new_y1, int new_x2, int new_y2 ) { 15 super( new_x1, new_y1, new_x2, new_y2 ); 16 } 17 18 public void paint( Graphics g ) { 19 int x = Math.min( x1, x2 ); 20 int y = Math.min( y1, y2 ); 21 int w = Math.abs( x2 - x1 ); 22 int h = Math.abs( y2 - y1 ); 23 g.setColor( color ); 24 if ( fill ) { 25 g.fillOval( x, y, w, h ); 26 } else { 27 g.drawOval( x, y, w, h ); 28 } 29 } 30 31 }