// WelcomeNagataniSub.java // Welcome Nagatani Web Page sub-Applet // by nagatani@eken.phys.nagoya-u.ac.jp import java.applet.Applet; import java.awt.*; import java.net.URL; import java.util.Vector; public class WelcomeNagataniSub extends Applet { Vector Objects; StringRoll StRoll; D3Polys polys; MediaTracker MT; public void init () { resize (size().width, size().height); MT = new MediaTracker (this); URL ImageURL; try { ImageURL = new URL (getDocumentBase(), "Welcome/"); } catch (java.net.MalformedURLException e) { ImageURL = getDocumentBase(); } Objects = new Vector (20,10); for (int n = 0 ; n < 5 ; n++) { Image image = getImage (ImageURL, "O" + (n+1) +".gif"); MT.addImage (image, 0); Objects.addElement (new StringFreeRun (image, this)); Objects.addElement (new StringFlying (image, this)); Objects.addElement (new StringFlying (image, this)); Objects.addElement (new StringFlying (image, this)); } Image image = getImage (ImageURL, "WelcomeNagatani.gif"); MT.addImage (image, 0); StRoll = new StringRoll (image, 50, 0, this); polys = new D3Polys (8); } public void paint (Graphics g) { // Clear Region g.setColor (getBackground()); g.fillRect (0, 0, size().width, size().height); g.setColor (getForeground()); // Wait for Load Image try { MT.waitForID (0); } catch (InterruptedException e) {} // Paint Back Objects for (int n = 0 ; n < Objects.size () ; n++) ((SGObject) (Objects.elementAt (n))). paint (g, this); // Paint Main Objects D3VecToD2 D3D2 = new D3VecToD2 (150, 125, 85.0, 1.5); polys.paintByDepth (g, D3D2, -1000, 0); StRoll.paint (g, this); polys.paintByDepth (g, D3D2, 0, 1000); } public void move () { for (int n = 0 ; n < Objects.size () ; n++) ((SGObject) (Objects.elementAt (n))). move (); StRoll.move (); polys.move (); } }