當前位置: 首頁>>代碼示例>>Java>>正文


Java Applet.setStub方法代碼示例

本文整理匯總了Java中java.applet.Applet.setStub方法的典型用法代碼示例。如果您正苦於以下問題:Java Applet.setStub方法的具體用法?Java Applet.setStub怎麽用?Java Applet.setStub使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.applet.Applet的用法示例。


在下文中一共展示了Applet.setStub方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fetchApplet

import java.applet.Applet; //導入方法依賴的package包/類
@Override
public Applet fetchApplet() {
    try {
        Hook.getInstance().init();

        final ASMClassLoader    classLoader = Context.getInstance().getASMClassLoader();
        final Class<?>          clientClass = classLoader.loadClass(Context.getInstance().getServerProviderInfo().getClientClass());
        final OSScapeParameters parser      = new OSScapeParameters();
        Object                  instance    = clientClass.newInstance();

        Utilities.handleOSScape(parser, classLoader);

        Applet applet = (Applet) instance;
        applet.setStub(new Stub(parser));

        return applet;
    } catch (Exception e) {
        e.printStackTrace();

        return null;
    }
}
 
開發者ID:Parabot,項目名稱:Parabot-317-API-Minified-OS-Scape,代碼行數:23,代碼來源:Loader.java

示例2: setStub

import java.applet.Applet; //導入方法依賴的package包/類
private static void setStub(Applet applet, final ClassLoader loader,
        boolean serialized, String beanName) throws ClassNotFoundException {
    // Get path to the resource representing the applet.
    String pathName = beanName.replace('.', '/');
    final String resourceName = serialized ? pathName.concat(".ser") : pathName.concat(".class"); //$NON-NLS-1$ //$NON-NLS-2$
    URL objectUrl = AccessController
            .doPrivileged(new PrivilegedAction<URL>() {
                public URL run() {
                    if (loader == null) {
                        return ClassLoader.getSystemResource(resourceName);
                    }
                    return loader.getResource(resourceName);
                }
            });

    // If we can't get to the applet itself, the codebase and doc base are
    // left as null.
    if (objectUrl == null) {
        applet.setStub(getAppletStub(getStubAppletContext(applet),
                null, null));
        return;
    }

    // Try to decompose the resource URL to get to the doc/code URL
    String urlString = objectUrl.toExternalForm();

    // This is the URL of the directory that contains the applet.
    int codeURLlength = urlString.length() - resourceName.length();
    URL codeBase = safeURL(urlString.substring(0, codeURLlength));

    // URL of the document containing the applet.
    int docURLlength = urlString.lastIndexOf('/');
    URL docBase = safeURL(urlString.substring(0, docURLlength + 1));

    applet.setStub(getAppletStub(getStubAppletContext(applet),
            codeBase, docBase));
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:38,代碼來源:Beans.java


注:本文中的java.applet.Applet.setStub方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。