Applet中共享basecode

applet中得到basecode
当这个值要被其他form使用时,可以保存在ThreadLocal或者其他Cache中

private   static  ThreadLocal codeBase  =   new  ThreadLocal();

codeBase.set(
this .getCodeBase());

public   static  Object getUrl() {
        
return codeBase.get();
    }

在其他的form中,可以用getUrl这个static method调用得到main frame的codebase
URL codeBase  =  (URL)MainFrame.getUrl();

你可能感兴趣的:(Applet中共享basecode)