// Alexander Clark // 3/10/08 import java.awt.Color; import java.awt.Graphics; public class MyRectangle { public int RectX1; public int RectY1; public int RectWidth; public int RectHeight; public boolean isFilled; public Color RectColor; // no argument constructor public MyRectangle(int x1, int y1, int width, int height, boolean fill, Color RectCol) { RectX1 = 0; RectY1 = 0; RectWidth = 0; RectHeight = 0; isFilled = false; RectColor = Color.BLACK; } public void setX1(int X1) //set method for each instance variable, verify that argument is >= 0 before setting. { if(X1 >= 0) { X1 = RectX1; } else { X1 = 0; } } public void setY1(int Y1) { if(Y1 >= 0) { Y1 = RectY1; } else { Y1 = 0; } } public void setWidth(int width) { if(width >= 0) { width = RectWidth; } else { width = 0; } } public void setHeight(int height) { if(height >= 0) { height = RectHeight; } else { height = 0; } } public int getX1() { return RectX1; } public int getY1() { return RectY1; } public int getWidth() { return RectWidth; } public int getHeight() { return RectHeight; } //HELP PLZ ! // draws shape. draw method should reference coordinates by get methods. public void draw( Graphics g ) { g.setColor( RectColor ); g.drawRect( RectX1, RectY1, RectWidth, RectHeight); if(RectX1 % 2 == 0) { g.fillRect(RectX1, RectY1, RectWidth, RectHeight); } } // end method draw } // end class MyLine