import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; public class titleanim extends java.applet.Applet implements Runnable{ Font f=new Font("TimesRoman",Font.BOLD,32); Thread runThread; URL imgURL,imgURL2; Image GumBall,GumBall_big; Image offscreenImg; Graphics offscreenG; int ax=5, ay=5, ayy=3; int x=0, y=0, yy=120; public void init() { String file_path="/~cwarner/img/GumBall.jpg"; try { imgURL=new URL("http","grove.ufl.edu",80,file_path); GumBall=getImage(imgURL); file_path="/~cwarner/img/GumBall_big.gif"; imgURL2=new URL("http","grove.ufl.edu",80,file_path); GumBall_big=getImage(imgURL2); } catch (Exception e) { int pts=0;} offscreenImg=createImage(480,300); offscreenG=offscreenImg.getGraphics(); } public void start() { if (runThread==null) { runThread=new Thread(this); runThread.start(); } } public void stop() { if (runThread!=null) { runThread.stop(); runThread=null; } } public void run() { try {Thread.sleep(2500);} catch (InterruptedException e) {} while (true) { try {Thread.sleep(160);} catch (InterruptedException e) {} x=x+ax; y=y+ay; yy=yy+ayy; if (x>399) ax=-1*ax; if (y>239) ay=-1*ay; if (x<1) ax=-1*ax; if (y<1) ay=-1*ay; if (yy>299) ayy=-1*ayy; if (yy<25) ayy=-1*ayy; repaint();} } public void update(Graphics g) { paint(g); } public void paint(Graphics g) { offscreenG.drawImage(GumBall_big,0,0,480,300,this); offscreenG.setFont(f); offscreenG.setColor(Color.white); offscreenG.drawString("Craig D Warner's Home Page",27,yy); offscreenG.drawImage(GumBall,x,y,this); g.drawImage(offscreenImg,0,0,this); } }