import javafx.scene.paint.Color; import javafx.scene.canvas.GraphicsContext; public class Square implements Drawable { private final double x; private final double y; private final double size; private final Color color; public Square(double x, double y, double size, Color color) { this.x = x; this.y = y; this.size = size; this.color = color; } public void draw(GraphicsContext pen) { pen.setFill(color); pen.fillRect(x - size, y - size, 2*size, 2*size); } }