Base java event POC
This commit is contained in:
38
src/main/java/ovh/gasser/newshapes/shapes/SRectangle.java
Normal file
38
src/main/java/ovh/gasser/newshapes/shapes/SRectangle.java
Normal file
@@ -0,0 +1,38 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user