Thread.sleep (1000) funktioniert nicht in Swing
Ich habe ein einfaches Animationsprogramm in Java Swing. Aber es funktioniert nicht.
try{
for(int i = 1; i<=500; i++){
ImageIcon icon = new ImageIcon("img\\COVERFront.jpg");
Image image = icon.getImage();
Image scaled = image.getScaledInstance(400, i, 0);
jLabel2.setIcon(new ImageIcon(scaled));
Thread.sleep(1000);
}
}
catch(InterruptedException ie){}
Ich arbeite in Netbeans 7.1.