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