bom, eu não sei o que é foxtrot…mas vai o codigo de como estoufazendo…
este trecho está no contrutor:
Runnable executa = new processo();
Thread tarefa = new Thread(executa);
tarefa.start();
está na thread a chamada que inicializa a duração:
class processo implements Runnable{
public void run() {
Espera j = new Espera();
j.setVisible(true);
j.setModal(true);
initialize();
AuxOcorrencia.buscaSituacao();
Usuario.setText(Login.getUsuario() + "-" + Login.getApelido());
if (!Login.isOperReceptivo()){
setTitle("Acionamento::: "+ Login.getIdGrupo()+"-" + Login.getNomeGrupo().toString().trim());
//Grupo.setText(Login.getIdGrupo());
//Grupo.setToolTipText(Login.getNomeGrupo().toString().trim());
buscaFicha();
ConsumidorTelefoneInfo.TelefoneVigenteAtivo(false,false);
}
[b]disparaRelogio();[/b]
j.dispose();
setVisible(true);
ConsumidorInfo.CPFCNPJDev.requestFocus();
/*
if (!Login.isOperReceptivo()){
try { Thread.sleep (500); } catch (InterruptedException ex) {}
if(!(ConsumidorTelefoneInfo.getFoneVigente()==null)){
if(Propriedades.str("equipamento").equalsIgnoreCase("MODEM")||Propriedades.str("equipamento").equalsIgnoreCase("ZOX")){
AuxModem discar = new AuxModem(ConsumidorTelefoneInfo.getDDDVigente() + ConsumidorTelefoneInfo.getFoneVigente());
}
}
}
*/
if (!Login.isOperReceptivo()){
waitForPackets();
}
}
}
public void disparaRelogio() {
if (timer == null) {
timer = new javax.swing.Timer(1000, this);
timer.setInitialDelay(0);
timer.start();
} else if (!timer.isRunning()) {
timer.restart();
}
}
para incrementar está no seguinte listener:
public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource() == timer){
if (statusPausa == false){
if(s < 59){
s = s + 1;
}
else if(m < 59){
m = m + 1;
s = 0;
}
String hora =
((m < 10) ? "0" : "")
+ m
+ ":"
+ ((s < 10) ? "0" : "")
+ s;
Duracao.setText(hora);
if (!isModoAlteracao()){
if (m >= Integer.parseInt(Propriedades.str("tempo.alerta"))){
if(!lblAlerta.isVisible()){
lblAlerta.setVisible(true );
}
}else{
if(lblAlerta.isVisible()){
lblAlerta.setVisible(false );
}
}
}
}
if(acnFecha == true){acnFecha=false;new Mensagem(null, "Acionamento", "Não há mais carga para o usuário", Mensagem.MSG_BOTAO_OK, Mensagem.MSG_ICONE_ALERTA);dispose();}
}
}
enfim, funciona, mas em algum momento sai pulando de três em três ou até de 15 em 15 segundos. Não consegui identificar quando que isso ocorre, mas não é com muita frequencia…
Thank´s. :?