public void run(){
while(anime!=null){
//淡入
for(int i=0;i<256;i+=32){
ImageFilter f=new FadeInFilter(i);
ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
fg_img=createImage(producer);
//等待到新图象准备好
MediaTracker mt=new MediaTracker(this);
mt.addImage(fg_img,1);
try{
mt.waitForID(1);
}catch(InterruptedException e){};
repaint();
try{
Thread.sleep(500);
}catch(InterruptedException e){};
fg_img.flush();
}
//淡出
for(int i=256;i>0;i-=32){
ImageFilter f=new FadeInFilter(i);
ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
fg_img=createImage(producer);
//等待到新图象准备好
MediaTracker mt=new MediaTracker(this);
mt.addImage(fg_img,1);
try{
mt.waitForID(1);
}catch(InterruptedException e){};
repaint();
try{
Thread.sleep(500);
}catch(InterruptedException e){};
fg_img.flush();
}
}
}
while(anime!=null){
//淡入
for(int i=0;i<256;i+=32){
ImageFilter f=new FadeInFilter(i);
ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
fg_img=createImage(producer);
//等待到新图象准备好
MediaTracker mt=new MediaTracker(this);
mt.addImage(fg_img,1);
try{
mt.waitForID(1);
}catch(InterruptedException e){};
repaint();
try{
Thread.sleep(500);
}catch(InterruptedException e){};
fg_img.flush();
}
//淡出
for(int i=256;i>0;i-=32){
ImageFilter f=new FadeInFilter(i);
ImageProducer producer=new FilteredImageSource(img1.getSource(),f);
fg_img=createImage(producer);
//等待到新图象准备好
MediaTracker mt=new MediaTracker(this);
mt.addImage(fg_img,1);
try{
mt.waitForID(1);
}catch(InterruptedException e){};
repaint();
try{
Thread.sleep(500);
}catch(InterruptedException e){};
fg_img.flush();
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货