File "MyOval.java"
Full Path: /home/analogde/www/Ebook/Informatique/JAVA/Source_TLS/Move/MyOval.java
File size: 626 bytes
MIME-type: text/plain
Charset: utf-8
package toto;
import java.awt.*;
public class MyOval extends MyShape
{
// constructor
public MyOval(int firstX,int firstY,int secondX,int secondY, Color shapeColor )
{
super( firstX, firstY, secondX, secondY, shapeColor );
}
// end constructor
// draw an oval
public void draw( Graphics g )
{
int upperLeftX = Math.min( getX1(), getX2() );
int upperLeftY = Math.min( getY1(), getY2() );
int width = Math.abs( getX1() - getX2() );
int height = Math.abs( getY1() - getY2() );
g.setColor( getColor() );
g.fillOval( upperLeftX, upperLeftY, width, height );
}
// end method draw
}// end class MyOval