I am trying to update the value of the same label from Running to Paused after 5 seconds. The entire code is inside a timer with a delay of 1 min.
Timer timer= new Timer(60000, new ActionListener() {
public void actionPerformed(ActionEvent e) {
label.setText("Running...");
//selenium code which takes around 5 seconds to run
label.setText("Paused");
}
});
However, the first setText is not working. The value is set to Paused after 5 seconds only. I tried using 2 labels, however both the values are being set after 5 seconds. Nothing is happening at the start.
How do I set the text as Running when the execution has started and then Paused after 5 seconds, until the timer hits the 1 minute mark?