コード例 #1
0
ファイル: Canvas.java プロジェクト: Nsl42/RushHourv2
 // 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();
 }
コード例 #2
0
ファイル: Canvas.java プロジェクト: Nsl42/RushHourv2
 /**
  * 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();
 }