Dynamically change the color of a Rectangle in Javafx

后端 未结 1 1921
情书的邮戳
情书的邮戳 2021-01-26 07:48

I am creating a two javafx.scene.shape.Rectangle objects in a GridPane and doing the following.

rectArray = new Rectangle[2];

boardGri         


        
相关标签:
1条回答
  • 2021-01-26 07:55

    You are sleeping on the UI thread which blocks any further processing (including refreshing the screen).

    If you need to delay some code you can use a PauseTransition to wait for two seconds and use its onFinished method to run the rest of your code after the wait.

    0 讨论(0)
提交回复
热议问题