First, work out the delay of 1 s, and then only the color of the button changes. Where is the mistake?
public void btnClick(ActionEvent actionEvent) { btn.setStyle("-fx-background-image: url('img/Yellow.png');"); Platform.runLater(() -> { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }); }