/** RedŽfinition de la mŽthode paintComponent() de JComponent */ public void paintComponent(Graphics g) { super.paintComponent(g); for (Shape s : shapes) { s.paint(g); } notifyObservers(); }
/** Redefinition de la methode paintComponent() de JComponent */ public void paintComponent(Graphics g) { super.paintComponent(g); for (Shape s : shapes) { s.paint(g); } for (Shape s : shapesCloneList) { s.paint(g); } }
public void duplication() { if (shapes.size() != 0) { for (Shape shape : shapes) { Shape clone = shape.duplicateShape(); Point point = new Point(shape.origin()); point.y += 120; clone.setOrigin(point); shapesCloneList.add(clone); System.out.println("shape is duplicated"); } this.repaint(); } }
public void textShape(String name) { if (shapes.size() != 0) { for (Shape shape : shapes) { shape.setText(name); } this.repaint(); } if (shapesCloneList.size() != 0) { for (Shape shapeClone : shapes) { shapeClone.setText(name); } this.repaint(); } }
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(); }