galera,seguinte.
Eu tenho um JLabel que precisa ir exibindo a hora por segundos, estou tentando usar o javax.swing.Timer para isso com NetBeans6
meu Codigo e:
public void iniciaHoraCorrente(){
String horaCorrenteSistema = "";
SimpleDateFormat horaFormatada = new SimpleDateFormat("HH:mm:ss");
Date horaAtual = new Date();
horaCorrenteSistema = horaFormatada.format(horaAtual);
horaCorrente.setVisible(true);
ActionListener action = new ActionListener() {
public void actionPerformed(ActionEvent e) {
horaCorrente.setText(horaCorrenteSistema);
}
};
Timer timer = new Timer(1000, action);
timer.start();
}
Isso não esta funcionando, o JLabel horaCorrente não inicia o contador do timer…é dessa maneira msm que se faz ???
Eu ouvi falar de um componente chamado TimerBean para fazer isso, mas não quero usar esse componente se conseguir fazer com que funcione o javax.swing.Timer.
Obrigado


