E ai pessoal !!
Tudo Beleza ?!!
Estou montando um joguinho de figuras geometricas e precisava
que as figuras aparecessem no painel aleatoriamente de 5 em 5 segundos
durante 60 segundos.
Estou com dificuldades na hora de utilizar o cronometro. 
[code]import java.awt.Component;
import java.util.Random;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class TestePainel {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Circulo f1 = new Circulo();
Quadrado f2 = new Quadrado();
Hexagono f3 = new Hexagono();
Retangulo f4 = new Retangulo();
Triangulo f5 = new Triangulo();
Losango f6 = new Losango();
// Vetor de figuras
Component[] figuras = {f1,f2,f3,f4,f5,f6};
int pos = 0;
Random sorte = new Random();
// Numero aleatorio da posição no vetor figuras
pos = sorte.nextInt(6);
JFrame frame = new JFrame("Teste Imagem");
JPanel painel = new Painel();
painel.add(figuras[pos]);
frame.getContentPane().add( painel);
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setSize(750, 500);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}[/code]
[code]package jog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Cronometro extends JPanel {
private static final long serialVersionUID = 1L;
JLabel label;
Timer timer;
static int current = 5;
public Cronometro() {
this.add(this.getLabel());
this.go();
}
public JLabel getLabel() {
if (this.label == null) {
this.label = new JLabel(this.current + "");
}
return this.label;
}
public void go() {
ActionListener action = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(current != 1)
label.setText(--current + "");
}
};
this.timer = new Timer(1000, action);
this.timer.start();
}
} [/code]
