Skip to content
Snippets Groups Projects
Commit 618e2124 authored by SAYEH Nahlane ghina's avatar SAYEH Nahlane ghina
Browse files

modification de ShapeContainer

parent c195287b
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import javafx.geometry.Point2D;
import javafx.scene.canvas.GraphicsContext;
public interface Shape {
int pointsCount();
Point2D point(int index);
void draw(GraphicsContext context);
......
package shape;
import javafx.scene.canvas.GraphicsContext;
import java.util.ArrayList;
import java.util.List;
public class ShapeContainer{
private List<Shape> shapes = new ArrayList<>();
public class ShapeContainer {
private List<Shape> shapes = new ArrayList<>(); // Liste des formes
public void addShape(Shape shape){}
// Méthode pour ajouter une forme au conteneur
public void add(Shape shape) {
shapes.add(shape);
}
public void draw(GraphicsContext context){
for(Shape shape : shapes)
// Méthode pour dessiner toutes les formes sur le canvas
public void draw(GraphicsContext context) {
for (Shape shape : shapes) {
shape.draw(context);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment