From 68e8215b635aa682d3aac6e9da333ba8c0a1a919 Mon Sep 17 00:00:00 2001 From: a23022716 <celia.arezki.1@etu.univ-amu.fr> Date: Fri, 11 Oct 2024 11:17:24 +0200 Subject: [PATCH] fix Rectangle class wich Contains methods to draw the rectangle, check if a point is inside, and move it. --- src/main/java/shape/tp5/Rectangle.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/shape/tp5/Rectangle.java b/src/main/java/shape/tp5/Rectangle.java index a862169..0f2ebd4 100644 --- a/src/main/java/shape/tp5/Rectangle.java +++ b/src/main/java/shape/tp5/Rectangle.java @@ -13,12 +13,12 @@ public class Rectangle implements Shape { @Override public void paint(GraphicsContext graphicsContext) { - graphicsContext.strokeRect(x, y, width, height); + graphicsContext.fillRect(x, y, width, height); } @Override - public boolean contains(double px, double py) { - return px >= x && px <= x + width && py >= y && py <= y + height; + public boolean contains(double x, double y) { + return x >= this.x && x <= this.x + width && y >= this.y && y <= this.y + height; } @Override -- GitLab