Exemplo n.º 1
0
 // Note: this is a slightly backwards way of maintaining the shape
 // objects. It is carefully designed to keep the visible shape interfaces
 // in this project clean and simple for educational purposes.
 public void draw(Object referenceObject, String color, Shape shape) {
   objects.remove(referenceObject); // just in case it was already there
   objects.add(referenceObject); // add at the end
   shapes.put(referenceObject, new ShapeDescription(shape, color));
   redraw();
 }
Exemplo n.º 2
0
 /**
  * Erase a given shape's from the screen.
  *
  * @param referenceObject the shape object to be erased
  */
 public void erase(Object referenceObject) {
   objects.remove(referenceObject); // just in case it was already there
   shapes.remove(referenceObject);
   redraw();
 }