diff --git a/src/main/java/shape/Circle.java b/src/main/java/shape/Circle.java index ab52746b1db28ebb18a9b8e1dbf0399dbd9b20b7..2f7796e48679cd55797b4f307d43646b12523137 100644 --- a/src/main/java/shape/Circle.java +++ b/src/main/java/shape/Circle.java @@ -7,17 +7,23 @@ import javafx.scene.paint.Color; public class Circle implements Shape { private double radius, x, y; + private Color fillColor; public Circle(double x, double y, double radius) { this.x = x; this.y = y; this.radius = radius; + this.fillColor = Color.GREEN; } @Override public void paint(GraphicsContext graphicsContext) { - graphicsContext.setStroke(Color.RED); + graphicsContext.setStroke(Color.BLACK); + if(isFinished) { + graphicsContext.setFill(Color.GREEN); + graphicsContext.fillOval(x - radius, y - radius, 2 * radius, 2 * radius); + } graphicsContext.strokeOval(x-radius, y-radius, 2 * radius, 2 * radius); } @@ -33,8 +39,17 @@ public class Circle implements Shape { this.x += dx; this.y += dy; } + + @Override + public boolean isFinished() { + return true; + } + public void updateRadius(double newX, double newY) { this.radius = Math.sqrt(Math.pow(newX - this.x, 2) + Math.pow(newY - this.y, 2)); } + public void setFillColor(Color fillColor) { + this.fillColor = fillColor; + } } diff --git a/src/main/java/shape/Rectangle.java b/src/main/java/shape/Rectangle.java index b896ba87ece4025e453eeda8900208904dee09d9..0a2f626c343f0edd949db68ba6d0990796f68692 100644 --- a/src/main/java/shape/Rectangle.java +++ b/src/main/java/shape/Rectangle.java @@ -36,6 +36,12 @@ public class Rectangle implements Shape{ x += dx; y += dy; } + + @Override + public boolean isFinished() { + return false; + } + public void updateSize(double newX, double newY) { this.width = Math.abs(newX - this.x); this.height = Math.abs(newY - this.y); diff --git a/src/main/java/shape/Shape.java b/src/main/java/shape/Shape.java index f376617dda8eb0eefb4333230b65d296cff455c6..66aaf02378b0f77a7ece2220aab8912326502650 100644 --- a/src/main/java/shape/Shape.java +++ b/src/main/java/shape/Shape.java @@ -7,4 +7,5 @@ public interface Shape { void paint(GraphicsContext graphicsContext); boolean contains(double x, double y); void translate(double dx, double dy); + boolean isFinished(); }