I'm trying to update a jlabel for a certain time because this same label will vary according to the database I tried to use thread, I studied about this same but I do not know if this would be the solution, I'm a bit confused about this class there material but no one talks to use that way I'm wanting, so far what I could do and a loop that starts after a certain time, if anyone can help I'm very grateful!
private class ImpressoraRun implements Runnable {
public void run() {
try {
while(labelstatus.getText().equals("Fechado")){
//objeto que verifica o banco.
pegastatuscaixa();
verificaPausa();
Thread.sleep(5 * 1000);
}
}
catch (InterruptedException e) {
}
}
}
}
Thread t = new Thread(new ImpressoraRun());
t.setDaemon(true);
t.start();