如何用java或delphi实现连续播放图片?(急!!) (100分)

  • 主题发起人 主题发起人 angelwcm
  • 开始时间 开始时间
A

angelwcm

Unregistered / Unconfirmed
GUEST, unregistred user!
我现在在做一个气象云图的项目,如何才能实现乡中央电视台的气象云图一样自动变化?
我们是民航部门查询用,实时气象图片资料已有,可是每隔一小时会有最新的图片,每次连续播放的都是最近更新的五幅图片,高手快帮帮忙!现在不知该如何不用手工去点击,而能自动显示云图的变化呢?
望赐教,不甚感谢。wcm@ah.ce-air.com
 
我给JAVA的实现吧:
=============================
package zrweng.JavaThread;
/**
*线程定时器
*/

import java.awt.*;
public class TimerThread extends Thread{
Component comp;
int timediff;
volatile boolean shouldRun;
public TimerThread(Component comp,int timediff){
this.comp=comp;
this.timediff=timediff;
shouldRun=true;
}
public void run(){
while(shouldRun){
try{
comp.repaint();
sleep(timediff);
}
catch(Exception e){
}
}
}

========================================
package zrweng.JavaThread;
/**
Applet动画主程序,显示十副动画
*/
import java.applet.*;
import java.awt.*;
public class Animate extends Applet{
int count;

int lastcount;
Image[] pictures;
TimerThread timer=null;
public void init(){
lastcount=10;
count=0;
pictures=new Image[10];
MediaTracker tracker=new MediaTracker(this);
for(int a=0;a<lastcount;a++){
pictures[a]=getImage(this.getCodeBase(),new Integer(a).toString()+".jpg");
tracker.addImage(pictures[a],0);
}
tracker.checkAll(true);
}
public void start(){
timer=new TimerThread(this, 1000);
timer.start();
}
public void stop(){
timer.shouldRun=false;
try{
timer.join();
}
catch(InterruptedException e){
}
timer=null;
}

public void paint(Graphics g){
g.drawImage(pictures[count++],0,0,null);
if(count==lastcount)
count=0;
}
public void printThreads(){
Thread ta[]=new Thread[Thread.activeCount()];
int n=Thread.enumerate(ta);
for(int i=0;i<n;i++)
System.out.println("Thread "+i+" is "+ta.getName());
}

}
 
接受答案了.
 
后退
顶部