/* File: mPoint.java */ import java.awt.*; public abstract class mPoint { // Instance variables: protected int x, y; // location of moving point protected int dx, dy; // displacement of moving point protected Color color; // color of moving point // Constructor: public mPoint( int new_x, int new_y ) { x = new_x; y = new_y; dx = 1; dy = 1; color = Color.black; } // Accessors and mutators: public int getX() { return x; } public int getY() { return y; } public void setPoint( int new_x, int new_y ) { x = new_x; y = new_y; } public void setDelta( int new_dx, int new_dy ) { dx = new_dx; dy = new_dy; } public Color getColor() { return color; } public void setColor( Color new_color ) { color = new_color; } // Class method: public void move() { x += dx; y += dy; } // Class methods to be implemented by subclasses: public abstract void paint( Graphics g ); public abstract void checkBoundary( Rectangle rect ); public abstract boolean isInside( int some_x, int some_y ); } // end of mPoint class