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

add of BorderDecorator class , it adds a border (a circle) around each point of the shape.

parent 259d36ec
Branches
No related tags found
No related merge requests found
package shape;
import javafx.scene.canvas.GraphicsContext;
import javafx.geometry.Point2D;
import javafx.scene.paint.Color;
public class BorderDecorator extends Decorator {
private double radius;
public BorderDecorator(Shape decoratedShape, double radius) {
super(decoratedShape);
this.radius = radius;
}
@Override
protected void drawDecoration(GraphicsContext graphicsContext) {
graphicsContext.setStroke(Color.BLACK);
for (int i = 0; i < decoratedShape.pointsCount(); i++) {
Point2D point = decoratedShape.point(i);
graphicsContext.strokeOval(point.getX() - radius, point.getY() - radius, radius * 2, radius * 2);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment