//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ // \\ // Applet for simple animated logos. \\ // \\ //\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\ import java.applet.*; import java.awt.*; import java.awt.image.*; import java.lang.*; import netscape.javascript.*; import java.awt.Color; import java.awt.Event; public class logotest extends java.applet.Applet { boolean started; JSObject reciever; boolean doingCB=false; Dimension sz; // Setup. get parameters from HTML. public void init() { sz=size(); if (reciever==null) reciever=JSObject.getWindow(this); } public void start() { System.err.println("start"); super.start(); started=true; repaint(0L); } public int getStarted() { return started?1:0; } public void stop() { System.err.println("stop"); super.stop(); started=false; } public void destroy() { System.err.println("destroy"); super.destroy(); System.err.println("destroy done"); } protected void finalize() throws Throwable { System.err.println("finalize"); super.finalize(); System.err.println("finalize done"); } public int callout(String fn) { if (reciever==null) if ((reciever=JSObject.getWindow(this))==null) return 1; if (!(reciever != null)) throw new Error("ASSERT Failed: reciever != null"); doCallback(fn, 0, 0); return 0; } protected void doCallback(String handler, int x, int y) { if (!doingCB) { doingCB=true; Object [] args = new Object[3]; args[0] = this; args[1] = new Integer(x); args[2] = new Integer(y); if (!(reciever != null)) throw new Error("ASSERT FAILED reciever != null"); if (!(handler != null)) throw new Error("ASSERT FAILED handler != null"); if (!(args != null)) throw new Error("ASSERT FAILED args != null"); if (!(args[0] != null)) throw new Error("ASSERT FAILED args[0] != null"); reciever.call(handler, args); doingCB=false; } } public void paint(Graphics g) { System.err.println("Paint"); if (started) { g.setColor(Color.red); g.fillRect(0,0,sz.width,sz.height); } } }