ho un problema...
praticamente ho una funzione in java che dovrebbe cambiare le immagini a 5 bottoni dopo un Thread.sleep di 500ms di distanza l'uno dall'altro il problema è che la funzione cambia le immagini al termine della stessa e questo non va bene.
qui c'e il codice della funzione
grazie in anticipo...codice:tcarte.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int time = 500; try { Thread.sleep(time); } catch (InterruptedException ie) { ie.printStackTrace(); } t1.setIcon(new ImageIcon(cambiaImg(man,1))); try { Thread.sleep(time); } catch (InterruptedException ie) { ie.printStackTrace(); } t2.setIcon(new ImageIcon(cambiaImg(man,2))); try { Thread.sleep(time); } catch (InterruptedException ie) { ie.printStackTrace(); } t3.setIcon(new ImageIcon(cambiaImg(man,3))); try { Thread.sleep(time); } catch (InterruptedException ie) { ie.printStackTrace(); } t4.setIcon(new ImageIcon(cambiaImg(man,4))); try { Thread.sleep(time); } catch (InterruptedException ie) { ie.printStackTrace(); } t5.setIcon(new ImageIcon(cambiaImg(man,5))); }

Rispondi quotando