import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; public class JView_Stocks extends java.applet.Applet implements Runnable{ Font f=new Font("TimesRoman",Font.BOLD,32); Thread JVThread; URL imgURL; Image chart; Image offscreenImg; Graphics offscreenG; int x=-1, xx=200, yy=200; String file[]=new String[3]; String out; public void init() { file[0]="https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+PUChart?prodid=DJIND:US:INDX&date=99049511"; file[1]="https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+PUChart?prodid=COMP.IDX:US:INDX&date=99049511"; file[2]="https://trading.etrade.com/cgi-bin/gx.cgi/AppLogic+PUChart?prodid=SP500:US:INDX&date="; offscreenImg=createImage(200,220); offscreenG=offscreenImg.getGraphics(); out=getParameter("out"); } public void start() { if (JVThread==null) { JVThread=new Thread(this); JVThread.start(); } } public void stop() { if (JVThread!=null) { JVThread.stop(); JVThread=null; } } public void run() { try {Thread.sleep(2000);} catch (InterruptedException e) {} while (true) { x=x+1; if (x>=3) x=x-3; try { imgURL=new URL(file[x]); chart=getImage(imgURL); } catch (Exception e) { int pts=0;} repaint(); try { for (int j=0; j<15; j++) { Thread.sleep(1000); } } catch (InterruptedException e) {} } } public boolean mouseDown(Event evt, int xm, int ym) { return true; } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { try { getAppletContext().showDocument(imgURL,out); } catch (Exception e) { int pts=0;} } }