import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class ImageType extends Applet{
int num=5;
Image imgs[];
public void init(){
imgs=new Image[num];
for(int i=0;i<num;i++)
{ imgs[i]=getImage(getDocumentBase(),"images/"+"t"+(i+1)+".gif");}
this. setBackground(Color.white);
}
public void paint(Graphics g ){
while(true){
for(int i=0;i<num;i++){
g.drawImage(imgs[i],0,0,this);
try{
Thread.sleep(2000);
}catch(InterrupteException e){
e.printStackTrace();
}
g.clearRect(0,0,getBounds().width,getBounds().height);
}
}
}
}
时间: 2024-10-24 08:50:15