Estou tentando fazer o fundo de um JPanel mudar de cor de 1 segundo em 1 segundo, porém quando chamo painel.setBackground(cor), o fundo do painel continua o mesmo… Alguém poderia me ajudar?
Mandaste repintar???
sim…
Código:
public class PainelTexto extends JPanel implements ActionListener
{
...
public void actionPerformed(ActionEvent e) {
this.setBackground(Color.BLACK);
repaint();
}
...
}
Vc está usando um Timer???
Sim…
this.timer = new Timer(500, this);
this.timer.start();
setOpaque(true); nao funciona ???
vlw brlima, funcionou agora