Skip to content
Snippets Groups Projects
Commit 68e8215b authored by AREZKI Celia's avatar AREZKI Celia
Browse files

fix Rectangle class wich Contains methods to draw the rectangle, check if a...

fix Rectangle class wich Contains methods to draw the rectangle, check if a point is inside, and move it.
parent 08fd7c8b
No related branches found
No related tags found
No related merge requests found
...@@ -13,12 +13,12 @@ public class Rectangle implements Shape { ...@@ -13,12 +13,12 @@ public class Rectangle implements Shape {
@Override @Override
public void paint(GraphicsContext graphicsContext) { public void paint(GraphicsContext graphicsContext) {
graphicsContext.strokeRect(x, y, width, height); graphicsContext.fillRect(x, y, width, height);
} }
@Override @Override
public boolean contains(double px, double py) { public boolean contains(double x, double y) {
return px >= x && px <= x + width && py >= y && py <= y + height; return x >= this.x && x <= this.x + width && y >= this.y && y <= this.y + height;
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment