/** * PointRelativeShape.java * * Declares an abstract class for shapes that have a point relative * to which the shape is defined. Demonstrates inheritance. * @author Scot Drysdale on 4/26/00 */ import java.awt.*; public abstract class PointRelativeShape extends GeomShape { // Coordinates of the point. The figure is defined relative // to this point. private int myX, myY; /** * Constructor. * @param x the x coordinate of the point * @param y the y coordinate of the point * @param theColor the color of the shape */ public PointRelativeShape(int x, int y, Color theColor) { super(theColor); myX = x; myY = y; } /** * @return the x value. */ public int getX() { return myX; } /** * @return the y value. */ public int getY() { return myY; } /** * Move the point by deltaX in x and deltaY in y. * @param deltaX the change in the x value * @param deltaY the change in tht y value */ public void move(int deltaX, int deltaY) { myX += deltaX; myY += deltaY; } }