[3968] in java-interest

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

Applets running applets

daemon@ATHENA.MIT.EDU (Gregg Helt)
Wed Dec 6 00:25:16 1995

Date: Tue, 5 Dec 1995 19:08:35 -0800 (PST)
From: Gregg Helt <gregg@fruitfly.berkeley.edu>
To: java-interest@java.sun.com


Can applets easily run other applets?  

What I'm really trying to do is get existing applets to display in a 
toplevel window (not within the browser window).  I've gotten as far as 
bringing up toplevel windows from an applet, but haven't been able to get 
the applet to draw in them.  Can anyone point me to sample source code?  

Even if this works for individual applets, it would be nice to be able to 
do this without mucking around in each applet.  So I thought I'd try to 
have an applet create a new Frame, then display another applet within it,
like this (modelled after a java program main):
	
	public 
	class TestAppletFrame extends Applet {
	  public TestAppletFrame()  {
	    Frame f = new Frame("appletframe");
	    Applet_class app = new Applet_class();
	    app.init();
	    app.start();
	    f.add(app);
	    f.resize(300,300);
	    f.show();
	  }
	}
where Applet_class is the applet to be displayed in the frame.
I'm gettin java.lang.NullPointerException errors at run-time though. Am I 
missing something obvious?  Is this completely the wrong way to do this?  
I expect there's a better OO approach...

							thanks,
							Gregg Helt

-
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