1 import java.awt.*; 2 import java.applet.*; 3 4 public class mRectangle extends mPoint { 5 6 public mRectangle(int _x, int _y, int _x2, int _y2) { 7 super(_x, _y, _x2, _y2); 8 }; 9 10 public void draw(Graphics g) { 11 if (fill) { 12 g.setColor(Color.black); 13 g.fillRect(x, y, x2-x, y2-y); 14 g.setColor(Color.yellow); 15 } 16 g.drawRect(x, y, x2-x, y2-y); 17 } 18 19 public boolean isIn(int _x, int _y) { 20 Rectangle r=new Rectangle(x, y, x2-x, y2-y); 21 return r.inside(_x, _y); 22 } 23 }