From 1f421f65a480307eacae4a3acc5a51d3533697f9 Mon Sep 17 00:00:00 2001
From: celia <celia.arezki.1@etu.univ-amu.fr>
Date: Thu, 3 Oct 2024 16:32:23 +0200
Subject: [PATCH] i changed App class because i cant have the same draw as the
 td so i changed it

---
 src/main/java/shape/App.java | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/main/java/shape/App.java b/src/main/java/shape/App.java
index 1a519e1..44bf6ab 100644
--- a/src/main/java/shape/App.java
+++ b/src/main/java/shape/App.java
@@ -7,11 +7,8 @@ import javafx.scene.Scene;
 import javafx.scene.canvas.Canvas;
 import javafx.scene.canvas.GraphicsContext;
 import javafx.scene.paint.Color;
-import javafx.scene.paint.Paint;
 import javafx.stage.Stage;
 
-
-
 public class App extends Application {
 
     public static void main(String[] args) {
@@ -21,15 +18,26 @@ public class App extends Application {
     @Override
     public void start(Stage primaryStage) {
         Group root = new Group();
-        Canvas canvas = new Canvas(130, 110);
+        Canvas canvas = new Canvas(300, 300); 
         GraphicsContext graphicsContext = canvas.getGraphicsContext2D();
+
         ShapeContainer shapeContainer = new ShapeContainer();
-        graphicsContext.setFill(Color.AQUAMARINE);
-        graphicsContext.fillOval(10,10,10,10);
-        shapeContainer.addShape(new Rectangle(Color.BLUE,new Point2D(10,10), new Point2D(40,40)));
+
+        Shape rect = new Rectangle(Color.GRAY, new Point2D(150, 150), new Point2D(250, 250));
+        Shape decoratedRect = new BorderDecorator(new CenterDecorator(rect, 5, Color.RED), 5, Color.BLUE);
+        shapeContainer.addShape(decoratedRect);
+
+        Shape triangle = new Polygon(Color.GRAY,
+                new Point2D(100, 50),
+                new Point2D(150, 150),
+                new Point2D(50, 150));
+        Shape decoratedTriangle = new BorderDecorator(new CenterDecorator(triangle, 5, Color.RED), 5, Color.BLUE);
+        shapeContainer.addShape(decoratedTriangle);
+
         shapeContainer.draw(graphicsContext);
+
         root.getChildren().add(canvas);
         primaryStage.setScene(new Scene(root));
         primaryStage.show();
     }
-}
\ No newline at end of file
+}
-- 
GitLab