当前位置: 首页>>代码示例>>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;未经允许,请勿转载。