package ovh.gasser.newshapes.shapes; import ovh.gasser.newshapes.attributes.ColorAttributes; import ovh.gasser.newshapes.attributes.SelectionAttributes; import ovh.gasser.newshapes.ShapeVisitor; import java.awt.*; public class SRectangle extends AbstractShape { private SRectangle(Rectangle rect) { super(rect); } @Override public void accept(ShapeVisitor visitor) { visitor.visitRectangle(this); } @Override public String toString() { return "SRectangle{" + super.toString() + '}'; } public static SRectangle create(int x, int y, int width, int height) { SRectangle rect = new SRectangle(new Rectangle(x, y, width, height)); rect.addAttributes(new SelectionAttributes()); return rect; } public static SRectangle create(int x, int y, int width, int height, Color color) { final SRectangle rect = create(x, y, width, height); rect.addAttributes(new ColorAttributes(false, true, Color.BLACK, color)); return rect; } }