I wanna create a pen tool using the Path2D Class. My problem is when comes the time to draw the shape we can see a dot at each intersection (see attached image).
https://i.stack.imgur.com/RSuID.png
Here is my code :
public void mouseDragged( MouseEvent e ) {
path2D.reset();
path2D.moveTo(last_x, last_y);
path2D.lineTo( mouse_x, mouse_y );
BasicStroke bs = new BasicStroke( 10, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND );
// g is a Graphic2D object
g.setStroke( bs );
g.setColor( new Color( 0.0f, 0.0f, 0.0f, 0.3f) );
g.draw( path2D );
repaint()
}
I understand that it caused by the transparency and the fact that it is not one Path that is drawn. Tried with only one Path2D instance but at each repaint the path is draw over and over and the transparency disappear.
Any solution ??
Thanks in advance !