import java.awt.Graphics; import java.awt.Image; import java.awt.Color; import java.io.*; import java.net.*; public class GlobeD extends java.applet.Applet implements Runnable { Image offscreenImage; Graphics offscreen; Image Pics[] = new Image[20]; Image currentImg; Thread runner; int x; int y = 50; int numImages=0; String delayTime; String scale; String[] gifs = new String[20]; URL page; int ImageWidth=0; int ImageHeight=0; double div; public void init() { scale=getParameter("height"); ImageHeight=new Integer(scale).intValue(); ImageWidth=new Integer(scale).intValue(); delayTime=getParameter("Delay"); if (delayTime==null) delayTime="500"; System.out.println(" div " + div); //--------------------------------------------------------------------------------- try { page =new URL("http://flameglo.lbl.gov/people/twood/images/animate.dat"); } catch (MalformedURLException e){} URLConnection conn=null; InputStreamReader in; BufferedReader data; String line; StringBuffer buf =new StringBuffer(); try { conn=this.page.openConnection(); conn.connect(); in=new InputStreamReader(conn.getInputStream()); data=new BufferedReader(in); while ((line=data.readLine()) !=null) { numImages=numImages+1; gifs[numImages-1]=line.trim(); } } catch (IOException e){} //} //--------------------------------------------------------------------------------- for (int i=0; i < numImages; i++) { Pics[i] = getImage(getCodeBase(), "images/" + gifs[i]); } //ImageHeight=(int)(Pics[0].getHeight(this)/div); //ImageWidth=(int)(Pics[0].getWidth(this)/div); offscreenImage=createImage(ImageWidth,ImageHeight); offscreen=offscreenImage.getGraphics(); }//end of init public void start() { if (runner == null) { runner = new Thread(this); runner.start(); } } public void stop() { runner = null; } public void run() { Thread thisThread=Thread.currentThread(); while (runner==thisThread) { for (int i=0;i "+ImageHeight+" "+ImageWidth); offscreen.drawImage(currentImg, 0, 0,ImageWidth,ImageHeight, this); screen.drawImage(offscreenImage, 0, 0, this); } }