[ale] OT: Swing + Applets

Jason Day jasonday at worldnet.att.net
Thu Aug 28 17:05:37 EDT 2003


On Thu, Aug 28, 2003 at 02:36:18PM -0400, Christopher Fowler wrote:
> 
> Pardon the ignorance:
> 
> Where do I override getCodeBase() ?
> 
> Exception in thread "main" java.lang.NullPointerException
>         at java.applet.Applet.getCodeBase(Applet.java:136)
>         at nn.pp.rc.RemoteConsoleApplet.init(Unknown Source)
>         at App.main(App.java:27)
> 
> One problem I have is that I do not have the source to the
> applet.  I only have the class files.

Ah, I thought you had the source for the applet.  In that case, you will
need to implement the java.applet.AppletStub interface, and set the stub
in the applet after you create it.  ie:

MyApplet applet = new MyApplet();
applet.setStub (new MyAppletStub());

The AppletStub interface defines the getCodeBase(), getAppletContext()
etc. methods.  The applet class just passes these method calls through
to the stub.

Since the applet is calling getCodeBase(), it probably wants to retrieve
something.  It may take several tries to figure out everything that
needs to be implemented and all the resources it wants.

Jason
-- 
Jason Day                                       jasonday at
http://jasonday.home.att.net                    worldnet dot att dot net
 
"Of course I'm paranoid, everyone is trying to kill me."
    -- Weyoun-6, Star Trek: Deep Space 9
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale





More information about the Ale mailing list