1  /*
  2   *  File:  DrawableObject.java
  3   *
  4   *  The superclass of all drawable objects
  5   *
  6   *  Copyright:  Northeast Parallel Architectures Center
  7   *  
  8   */
  9  
 10  import java.awt.*;
 11  
 12  public abstract class DrawableObject {
 13  
 14    protected int x1, y1, x2, y2;
 15    protected boolean fill;
 16    protected Color color;
 17  
 18    public DrawableObject( int new_x1, int new_y1, int new_x2, int new_y2 ) {
 19      x1 = new_x1; y1 = new_y1;
 20      x2 = new_x2; y2 = new_y2;
 21      fill = false;
 22      color = Color.black;
 23    }
 24  
 25    public int getX() { return x1; }
 26    public int getY() { return y1; }
 27    
 28    public void setEndpoint( int new_x2, int new_y2 ) {
 29      x2 = new_x2; y2 = new_y2;
 30    }
 31    
 32    public void setFill( boolean new_fill ) {
 33      fill = new_fill;
 34    }
 35  
 36    public Color getColor() { return color; }
 37  
 38    public abstract void paint( Graphics g );
 39  
 40    public abstract boolean contains( int x, int y );
 41  
 42  }