How to change line appearance?
Hi all,
I would like to dynamically change line plot appearance from solid to dashed or dotted.
The only solution found is this one:
using this method
Code:
line.setStyle("-fx-stroke-dash-array: 2 12 12 2;");
I must use a refresh such as
Code:
pane.getChildren().remove(line);
pane.getChildren().add(line);
where pane is a BorderPane.
otherwise line do not turn to dashed from solid.(Windows XP).
Is there a different way other than this one?
What's more, in Linux there is no need to use remove and add, it works correctly.
Thank you all
Susie
Re: How to change line appearance?
I have found a solution for this issue by using
Code:
line.getStrokeDashArray().addAll(25d, 20d, 5d, 20d);
Is there a way to use these values in a variable so to use as parameters?
In example:
public static final DASH_LINE = ......
Regards
Susie
Re: How to change line appearance?
Yes...
public static final Double[]DASHED_VALUE = {12d, 2d, 2d, 12d};
Susie