السلام عليكم..
كما في العنوان.. أريد أن أرسم مستطيل ضلعه الأيمن غير موجود.. باستخدام Polyline2D..
أو أي طريقة أخرى..
مع العلم أنني أقوم برسم متجهات..
قمت برسم المربع والمستطيل والدائرة من غير أية مشاكل .. وهذا نموذج من الرسم
public RoundRectangle(Point start, Point end, Color color) {
super(color);
position = new Point(Math.min(start.x, end.x),
Math.min(start.y, end.y));
roundRectangle= new RoundRectangle2D.Double(origin.x,
origin.y,
Math.abs(start.x - end.x), // Width
Math.abs(start.y - end.y),15,15); // & height
}
public Shape getShape() {
return roundRectangle;
}
public java.awt.Rectangle getBounds() {
return getBounds(roundRectangle.getBounds());
}
public void modify(Point start, Point last) {
position.x = Math.min(start.x, last.x);
position.y = Math.min(start.y, last.y);
roundRectangle.width = Math.abs(start.x - last.x);
roundRectangle.height = Math.abs(start.x - last.x);
}
public void draw(Graphics2D g2D) {
draw(g2D,roundRectangle);
}مع الشكر الجزيل





