I am trying to add a timer in my screen recording application being developed using JavaFX (IDE: NetBeans) and OS (Win 10). I am adding a timer now, which is to be used as:
User clicks on start recording, A Label on my application should start showing the time as 00:00:00, I have the time in seconds which is being printed on console even but when I use it to be displayed on application it just shows 0 Seconds. I am attaching code too. Kindly help. How can I refresh app interface or run timer when I have the value, It is just not updating.
Here you can see my app doesn't start timer; however, is being printed on consoleApp's Snap Console Snap
private void scheduleTimerTasks() {
isRecording = true;
int delay =50;
long period = 500;
//1000 / 48;
RecordTimer.reset();
timerRecord = new Timer("Thread TimerRecord");
timerCount = new Timer("Thread TimerCount");
recorderTask = new ScreenRecorderTask(encoder, rectangle);
countTask = new TimerCountTask(Timer);
timerRecord.scheduleAtFixedRate(recorderTask, delay, period);
timerCount.scheduleAtFixedRate(countTask, delay, period);
Timer.setText(""+countTask.timeInSec+" s"); //Setting Label Text
System.out.println(countTask.timeInSec);
recordStateLabel.setText("recorder Started...");
}