I am building an application using JavaFx that displays the current date and time in the top corner of the scene.
But it Display an IllegalStateException Error. Here's my code.
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
new Thread(new Runnable() {
@Override
public void run() {
while(true){
Date d=new Date();
String date1=d.toString();
String arr[]=date1.split(" ");
String dd= arr[5]+"/"+arr[1]+"/"+arr[2];
date.setText(dd);
time.setText(arr[3]);
}
}
}).start();
}
}
I Don't Know How to Use Platform.runLater(...) for This Code.