I would like to dynamically change the draw of a line from solid, dotted or dashed: it seems I have to use line.setStroke, is it the correct method?
And, how to accomplish this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No that is not the correct method, setStroke sets the color of the stroke.
Correct method is
getStrokeDashArray().add():StrokeDashArray defines the pattern of line and gap sequences. See the following different patterns as output of aboves:
Of course by manipulating the StrokeDashArray array elements you can change the pattern dynamically.