2016-11-26 35 views
0

我創建了一個地圖,我不會動任何東西它只是讓線條厚或薄的Th問題是我想看到的動作,所以我用了Thread.sleep消失() ; 但整個場面然後凍結的全部時間,我什麼也看不見,直到超時,所以我怎麼能解決這個問題或有什麼問題?的情景使用的Thread.sleep java的

+0

你在主線程中運行呢? – FunctionR

+0

是,在開始()我叫一些其他的功能,我想暫停處理與該功能 – Ammar

回答

0

你可能阻止應用程序線程。

做的更好使用動畫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();