[5538] in java-interest

home help back first fref pref prev next nref lref last post

No subject found in mail header

daemon@ATHENA.MIT.EDU (Roger Day)
Thu Feb 15 15:10:35 1996

Date: Thu, 15 Feb 1996 18:37:04 GMT
From: roger@ssynth.co.uk (Roger Day)
To: java-interest@java.sun.com

I'm trying to extend the Surfomatic applet (see www.gamelan.com for full details) with a pretty frontend, including a canvas like so

public class Surfomatic extends Applet implements Timeable {
	public void init() {
   <snip>
	MyCanvas h = new MyCanvas(this);
        add("West",h);
        show();
  	}
}

where MyCanvas is

class MyCanvas extends Canvas {
    Image logo;
    Surfomatic m;
  MediaTracker eyeOut;
    static final int BEGIN_ID = 0;
    static final int FRAME_ID = 1;
    URL nw;


	public MyCanvas (Surfomatic l) {
    	m = l;    
	try {
	  nw = new  URL("http://caligula.ssynth.co.uk/~rday/carpet.gif");
	} catch (Exception e) {
	   System.out.println("Cant load image" + e.getMessage());
	}  
	logo = m.getImage(nw);
	eyeOut.addImage(logo, FRAME_ID);
	try {
		eyeOut.waitForID(FRAME_ID);
	} 	//end try
	catch(InterruptedException e) {}	//e  
	resize(logo.getWidth(m),logo.getHeight(m));
	}
    public void paint(Graphics g) {
	g.drawImage(logo,0, 0, m);
    }
 public boolean handleEvent(Event e) {
                System.out.println("Handleevent");
                return (super.handleEvent(e));
        }   

	
}

However, when it gets to getImage, it bombs out. Anyone any ideas? It works without implementing Timer, but I have no idea why.

Cheers,

Roger.
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post