0

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?

Ammar
  • 13
  • 5

1 Answers1

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