1  /* mPoint.java */

  2  

  3  import java.awt.*;

  4  

  5  public class mPoint {

  6    int x, y;

  7    Color color = Color.black;

  8    public mPoint(int _x, int _y) {

  9      /* initial location */

 10      x = _x;

 11      y = _y;

 12    }

 13    public void setColor(Color _color) { color = _color;}

 14    /* check if position inside object */

 15    public boolean isInside(int _x, int _y) {

 16      return (x == _x) && (y == _y);

 17    }

 18    /* move object */

 19    public void moveTo(int _x, int _y) {

 20      if ( (x == _x) && (y == _y) ) return;

 21      x = _x;     /* update location */

 22      y = _y;

 23    }

 24    public void move(int dx, int dy) {

 25      if ( (dx == 0) && (dy == 0) ) return;

 26      x += dx;     /* update location */

 27      y += dy;

 28    }

 29    public void paint(Graphics g) {}

 30  }