示例#1
0
  public void dupliquer() {
    for (Shape s : shapeSelect) {
      Point p = new Point(s.getOrigin());
      p.y += 100;

      if (s instanceof Rectangle) {
        Rectangle r = (Rectangle) s;
        shapes.add(new Rectangle(p, r.getWidth(), r.getHeight(), r.getColor()));
        cpt++;
        notifyObservers();
      }

      if (s instanceof Circle) {
        Circle c = (Circle) s;
        shapes.add(new Circle(p, c.getRadius(), c.getColor()));
        cpt++;
        notifyObservers();
      }
    }

    shapeSelect.clear();
    this.repaint();
  }