/** * Code to paint the specific shape * * @param w2v 2D affine transform * @param g graphics context */ public void paintShape(Graphics2D g, AffineTransform w2v) { double x = startPoint.getX(); double y = startPoint.getY(); double xEnd = endPoint.getX(); double yEnd = endPoint.getY(); g.setStroke(new BasicStroke(this.getThickness(), BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND)); Point2D v0 = w2v.transform(new Point2D.Double(x, y), null); int ix = (int) v0.getX(); int iy = (int) v0.getY(); Point2D v1 = w2v.transform(new Point2D.Double(xEnd, yEnd), null); g.drawLine(ix, iy, (int) v1.getX(), (int) v1.getY()); }