I have created a map and I will not move any thing on it just make lines thick or thin Th problem is that I want to see the action so I used Thread.sleep(); But the whole scene then freezes the whole time and I can see nothing until time out so How can I fix that or what is the problem?
Asked
Active
Viewed 133 times
0
-
Are you running this in the main thread? – apxcode Nov 26 '16 at 19:01
-
yes, in start() I call some other function and I want to suspend processing with that function – Ammar Nov 26 '16 at 19:03
1 Answers
0
You probably block the application thread.
Better do the animation using a Timeline
:
Line line = ...
double startWidth = ...
double endWidth = ...
Timeline animation = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(line.strokeWidthProperty(), startWidth)),
new KeyFrame(Duration.seconds(3), new KeyValue(line.strokeWidthProperty(), endWidth)));
animation.play();

fabian
- 80,457
- 12
- 86
- 114