Source of TwoEndsShape.java


  1: 
  2: package draw1; 
  3: 
  4: import java.awt.Graphics;
  5: import java.awt.Color;
  6: 
  7: public abstract class TwoEndsShape extends scribble3.Shape implements Cloneable { 
  8: 
  9:   public TwoEndsShape() {} 
 10:   
 11:   public TwoEndsShape(Color color) {
 12:     super(color); 
 13:   } 
 14: 
 15:   public Object clone() throws CloneNotSupportedException { 
 16:     return super.clone(); 
 17:   }
 18: 
 19:   public void setEnds(int x1, int y1, int x2, int y2) { 
 20:     this.x1 = x1; 
 21:     this.y1 = y1; 
 22:     this.x2 = x2; 
 23:     this.y2 = y2;
 24:   }
 25: 
 26:   public void setEnd1(int x1, int y1) { 
 27:     this.x1 = x1; 
 28:     this.y1 = y1; 
 29:   }
 30: 
 31:   public void setEnd2(int x2, int y2) { 
 32:     this.x2 = x2; 
 33:     this.y2 = y2; 
 34:   }
 35: 
 36:   public int getX1() { 
 37:     return x1; 
 38:   }
 39: 
 40:   public int getY1() { 
 41:     return y1; 
 42:   }
 43: 
 44:   public int getX2() { 
 45:     return x2; 
 46:   }
 47: 
 48:   public int getY2() { 
 49:     return y2; 
 50:   }
 51: 
 52:   abstract public void drawOutline(Graphics g, int x1, int y1, int x2, int y2); 
 53: 
 54:   protected int x1;
 55:   protected int y1;
 56:   protected int x2;
 57:   protected int y2;
 58: 
 59: }