Timer timer = new Timer();
timer.schedule(new AlteraImg(), 0, (3*1000));
estou recebendo oseguinte erro na classe AlteraImg:
mas recebo o erro:
Exception in thread "Timer-1" java.lang.NullPointerException
at br.com.csv.alertapendencia.view.CaixaAlta$AlteraImg.proxImg(CaixaAlta.java:395)
at br.com.csv.alertapendencia.view.CaixaAlta$AlteraImg.run(CaixaAlta.java:415)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
private static class AlteraImg extends TimerTask{
private static void proxImg(){
z++;
String pathImg = "c:\\Documents and Settings\\Desktop\\Imagem\\img"+z+".jpg";
lbImg.setIcon(new javax.swing.ImageIcon(pathImg));
lbImg.repaint();
List<ImgBean> listaimg = new ArrayList<ImgBean>();
listaImg = ImgDAO.listaImg();
if(z == listaImg.size()-1)
z = 0;
}
public void run() {
proxImg();
}
}