|
i can draw an arrow mark in a line but the arrow is not rotating when the line move.
i can draw an arrow mark in a line but the arrow is not rotating when the line moves. here i am placing the code . can any one help me that line should move as well as arrow mark should also move in the same direction.please send as soon as possible.thanks.
AffineTransform at = AffineTransform.getTranslateInstance((point2.x + point4.x)/2, (point2.y + point4.y)/2);
at.rotate(angle);
int length = 6;
int b = 10;
double angle = Math.toRadians(45);
GeneralPath path = new GeneralPath();
path.moveTo(5, 6);
path.moveTo(0,0);
// Double d = new Double(angle);
// int a = d.intValue();
int x = (int) (-b* Math.cos(angle));
int y = (int) (b * Math.sin(angle));
path.lineTo(x, y);
x = (int) (-b * Math.cos(-angle));
y = (int) (b * Math.sin(-angle));
path.moveTo(5, 6);
path.moveTo(0,0);
path.lineTo(x, y);
Shape shape = at.createTransformedShape(path);
// graphics2D.setPaint(Color.black);
graphics2D.draw(shape);
drawLine(graphics2D, point2.x, point2.y, point4.x, point4.y);
|