(Math.abs(x1), Math.abs(y1), Math.abs(x2), Math.abs(y2));
final Rectangle2D shapeBounds = line.getBounds2D();
final Shape transformedShape =
ShapeTransform.translateShape(line, -shapeBounds.getX(), -shapeBounds.getY());
// and use that shape with the user's bounds to create the element.
final ContentElementFactory elementFactory = new ContentElementFactory();
elementFactory.setName(name);
elementFactory.setColor(c);
elementFactory.setStroke(stroke);
elementFactory.setX(new Float(shapeBounds.getX()));
elementFactory.setY(new Float(shapeBounds.getY()));
elementFactory.setMinimumWidth(new Float(shapeBounds.getWidth()));
elementFactory.setMinimumHeight(new Float(shapeBounds.getHeight()));
elementFactory.setContent(transformedShape);
elementFactory.setScale(Boolean.TRUE);
elementFactory.setKeepAspectRatio(Boolean.FALSE);
elementFactory.setShouldDraw(Boolean.TRUE);
element = elementFactory.createElement();
}
}