import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class Teste extends JFrame implements ActionListener
{
  public JLabel l1, l2;
  JButton botao;
  public Teste()
  {
    addWindowListener(new WindowAdapter()
                       {
                         public void windowClosing(WindowEvent e)
                         {
                           System.exit(0);
                         }
                       }
                     );
    setSize(300, 200);
    this.getContentPane().setLayout(new BorderLayout());
    botao = new JButton("Teste");
    this.getContentPane().add("North",botao);
    botao.addActionListener(this);
    l1 = new JLabel("Desatualizado");
    this.getContentPane().add("Center", l1);
    l2 = new JLabel("deveria ser atualizada a hora aqui");
    this.getContentPane().add("South", l2);
  }
  public void actionPerformed(ActionEvent evt)
  {
    l1.setText("Atualizado pelo setText");
    l2.setText("Por que eh que aqui atualiza??");
  }
  public void atualizaLabel()
  {
    Date hoje = new Date();
    l2.invalidate();
    l2.setText(" " +(hoje.getHours()) + ":" + hoje.getMinutes() + ":" + hoje.getSeconds());
    validate();
    System.out.println(" " +(hoje.getHours()) + ":" + hoje.getMinutes() + ":" + hoje.getSeconds());
  }
  public static void main(String[] args)
  {
    Teste f = new Teste();
    f.setVisible(true);
    Thread t = new Thread(new Relogio());
    t.start();
  }
}
class Relogio extends Teste implements Runnable
{
  public void run()
  {
    while (true)
    {
      atualizaLabel();
      try
      {
        Thread.sleep(1000);
      }
      catch (InterruptedException e){}
    }
  }
}