Example #1
0
  public static void main(String[] args) {

    DrawingTablet dt = new DrawingTablet(100, 100);

    DrawableCircle dc = new DrawableCircle(50, 50, 30);
    dc.setColor(Color.yellow);
    dt.drawShape(dc);

    DrawablePoint dp = new DrawablePoint(40, 50);
    dp.setColor(Color.red);
    dt.drawShape(dp);
    for (int i = 1; i <= 5; i++) {
      dp.translate(5, 0);
      dt.drawShape(dp);
    }

    DrawableString ds = new DrawableString(30, 45, "Testing.");
    dt.drawShape(ds);

    DrawableLine newLine = new DrawableLine(15, 16, 55, 60);
    newLine.setColor(Color.blue);
    dt.drawShape(newLine);

    DrawableRectangle newRect = new DrawableRectangle(30, 35, 25, 30);
    newRect.setColor(Color.green);
    dt.drawShape(newRect);

    DrawableRectangle newSqr = new DrawableRectangle(65, 70, 55, 55);
    newSqr.setColor(Color.pink);
    dt.drawShape(newSqr);

    dt.show();
  }
Example #2
0
 /**
  * test the main method for lab part 2
  *
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
   FileOutputStream output = new FileOutputStream("aCircle.txt");
   DataOutputStream dos = new DataOutputStream(output);
   DrawableCircle thisCircle = new DrawableCircle(15, 20, 25);
   thisCircle.write(dos);
   FileInputStream input = new FileInputStream("aCircle.txt");
   DataInputStream dis = new DataInputStream(input);
   dis.readLine();
   DrawableCircle copy = new DrawableCircle(dis);
   System.out.println(copy.toString());
   System.out.println(thisCircle.toString());
   dos.close();
 }
Example #3
0
 public DrawableCircle(DrawableCircle obj0, DrawableCircle obj1, double interp) {
   super(obj0, obj1, interp);
   double theRadius = (1.0 - interp) * obj0.getRadius() + (interp) * obj1.getRadius();
   radius = (int) theRadius;
 }