public class caixa extends javax.swing.JFrame{
Sessao sessao;
Vendas venda;
public File diretorio;
public File imgs[];
public File[] getImgs(){
return this.imgs;
}
/** Creates new form caixa */
public caixa() {
initComponents();
diretorio = new File("C:\evasVendas\dist\imgs\");
imgs = diretorio.listFiles();
}
public void setKeys(){
//Animar
Action alF12 = new AbstractAction() {
public void actionPerformed(ActionEvent actionEvent) {
animar();
}
};
JPanel content = (JPanel) this.getContentPane();
KeyStroke f12 = KeyStroke.getKeyStroke("F12");
InputMap inputMap = content.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(f12, "F12");
content.getActionMap().put("F12", alF12);
}
public void animar(){
caixa.SlideShow slide = new caixa().new SlideShow();
slide.play();
}
class SlideShow {
public void play() {
Thread t = new Thread(new SlideRun());
t.start();
}
class SlideRun implements Runnable {
public void run() {
int i = 0;
double tempo = 0;
try {
while (true) {
Thread.sleep(3500);
System.out.println(imgs.length);
}
}catch (InterruptedException e) {}
}
}
}
}
O código eh mto grande… mas em resumo é isso ae!
init:
deps-jar:
compile:
run:
Exception in thread “Thread-2” java.lang.NullPointerException
at evasvendas.caixa$SlideShow$SlideRun.run(caixa.java:887)
at java.lang.Thread.run(Thread.java:619)
EXECUTADO COM SUCESSO (tempo total: 14 segundos)
LINHA 887: System.out.println(imgs.length);