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


Java AppletStub類代碼示例

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


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

示例1: run

import java.applet.AppletStub; //導入依賴的package包/類
public void run() {

   try {
      Class cls = Class.forName(loadAppletName);
      JApplet app = (JApplet)cls.newInstance();
      app.setStub((AppletStub)this);
      app.init();
      
     
      getContentPane().add("Center", app);
      loadApplet = app;
      validate();
     
      if(isStarted) {
     	 loadApplet.start();
      }
      validate();
   } catch (Throwable e) {
  	 loadApplet = null;
      AppletLogger.showError("Exception:", e);
      
      e.printStackTrace();
      validate();
   }
   System.out.println("Thread end");
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:27,代碼來源:AppletLaunch.java

示例2: loadClientApplet

import java.applet.AppletStub; //導入依賴的package包/類
private static Applet loadClientApplet(URL resourceURL, URL serverURL, RSAPublicKey key, boolean members) throws GameClientModificationException {
    LOG.info("Loading client applet, server: {}, resources: {}", serverURL, resourceURL);

    final Class<Applet> clazz = GameClient.loadClientAppletClass(resourceURL, key);

    final AppletStub stub = new MockAppletStub(resourceURL, serverURL, GameClient.buildParameterMap(members));

    try {
        final Applet applet = clazz.getConstructor(GameClientCallback.class).newInstance(stub);
        applet.setStub(stub);

        return applet;
    }
    catch (ReflectiveOperationException e) {
        throw new GameClientModificationException("Unable to instantiate client", e);
    }
}
 
開發者ID:reines,項目名稱:rsc,代碼行數:18,代碼來源:GameClient.java

示例3: getAppletStub

import java.applet.AppletStub; //導入依賴的package包/類
private static AppletStub getAppletStub(final AppletContext context, final URL codeBase, final URL docBase) {

        return new AppletStub() {
            public boolean isActive() {
                return true;
            }

            public URL getDocumentBase() {
                return docBase;
            }

            public URL getCodeBase() {
                return codeBase;
            }

            public String getParameter(String name) {
                // Applet beans have no params.
                return null;
            }

            public AppletContext getAppletContext() {
                return context;
            }

            public void appletResize(int width, int height) {
                // Do nothing.
            }
        };
    }
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:30,代碼來源:Beans.java

示例4: initApplet

import java.applet.AppletStub; //導入依賴的package包/類
/**
 * Call this method to initialize an applet from your launcher class
 * <code>MyAppletLauncher.init()</code> method.
 *
 * @param sClass class name in form "MyClass" for default package
 * or "com.abc.MyClass" for class in some package
 *
 * @param appletParent parent applet from a launcher.
 *
 * @throws Throwable wrapper for many exceptions thrown while applet
 * instantiation and calling init() method.
 */
public void initApplet(String sClass, final JApplet appletParent) throws Throwable {
    Class<?> clazz = loadClass(sClass);
    logInfo(LogArea.CONFIG, "initApplet() --> %s.init(); Loader: %s", sClass, clazz.getClassLoader());
    applet = (JApplet)clazz.newInstance();
    applet.setStub(new AppletStub() {
        @Override
        public boolean isActive() {
            return appletParent.isActive();
        }
        @Override
        public URL getDocumentBase() {
            return appletParent.getDocumentBase();
        }
        @Override
        public URL getCodeBase() {
            return appletParent.getCodeBase();
        }
        @Override
        public String getParameter(String name) {
            return appletParent.getParameter(name);
        }
        @Override
        public AppletContext getAppletContext() {
            return appletParent.getAppletContext();
        }
        @Override
        public void appletResize(int width, int height) {
            appletParent.resize(width, height);
        }
    });
    applet.init();
    appletParent.setContentPane(applet.getContentPane());
}
 
開發者ID:Energyxxer,項目名稱:Vanilla-Injection,代碼行數:46,代碼來源:JarClassLoader.java

示例5: initApplet

import java.applet.AppletStub; //導入依賴的package包/類
/**
 * Call this method to initialize an applet from your launcher class
 * <code>MyAppletLauncher.init()</code> method.
 *
 * @param sClass class name in form "MyClass" for default package or "com.abc.MyClass" for class
 *        in some package
 *
 * @param appletParent parent applet from a launcher.
 *
 * @throws Throwable wrapper for many exceptions thrown while applet instantiation and calling
 *         init() method.
 */
public void initApplet(String sClass, final JApplet appletParent) throws Throwable {
  Class<?> clazz = loadClass(sClass);
  logInfo(LogArea.CONFIG, "initApplet() --> %s.init(); Loader: %s", sClass,
      clazz.getClassLoader());
  applet = (JApplet) clazz.newInstance();
  applet.setStub(new AppletStub() {
    @Override
    public boolean isActive() {
      return appletParent.isActive();
    }

    @Override
    public URL getDocumentBase() {
      return appletParent.getDocumentBase();
    }

    @Override
    public URL getCodeBase() {
      return appletParent.getCodeBase();
    }

    @Override
    public String getParameter(String name) {
      return appletParent.getParameter(name);
    }

    @Override
    public AppletContext getAppletContext() {
      return appletParent.getAppletContext();
    }

    @Override
    public void appletResize(int width, int height) {
      appletParent.resize(width, height);
    }
  });
  applet.init();
  appletParent.setContentPane(applet.getContentPane());
}
 
開發者ID:Adrodoc55,項目名稱:MPL,代碼行數:52,代碼來源:JarClassLoader.java

示例6: createApplet

import java.applet.AppletStub; //導入依賴的package包/類
/**
 * Create an AppletInstance.
 *
 * @param file the JNLP file
 * @param enableCodeBase whether to add the codebase URL to the classloader
 * @param cont container where to put applet
 * @return applet
 * @throws net.sourceforge.jnlp.LaunchException if deploy unrecoverably die
 */
 //FIXME - when multiple applets are on one page, this method is visited simultaneously
//and then appelts creates in little bit strange manner. This issue is visible with
//randomly showing/notshowing spalshscreens.
//See also PluginAppletViewer.framePanel
protected  AppletInstance createApplet(JNLPFile file, boolean enableCodeBase, Container cont) throws LaunchException {
     AppletInstance appletInstance = null;
     try {
        JNLPClassLoader loader = JNLPClassLoader.getInstance(file, updatePolicy, enableCodeBase);

        if (enableCodeBase) {
            loader.enableCodeBase();
        } else if (file.getResources().getJARs().length == 0) {
            throw new ClassNotFoundException("Can't do a codebase look up and there are no jars. Failing sooner rather than later");
        }

        ThreadGroup group = Thread.currentThread().getThreadGroup();

        // appletInstance is needed by ServiceManager when looking up 
        // services. This could potentially be done in applet constructor
        // so initialize appletInstance before creating applet.
        if (cont == null) {
             appletInstance = new AppletInstance(file, group, loader, null);
         } else {
             appletInstance = new AppletInstance(file, group, loader, null, cont);
         }

        loader.setApplication(appletInstance);

        // Initialize applet now that ServiceManager has access to its
        // appletInstance.
        String appletName = file.getApplet().getMainClass();
        Class<?> appletClass = loader.loadClass(appletName);
        Applet applet = (Applet) appletClass.newInstance();
        applet.setStub((AppletStub)cont);
        // Finish setting up appletInstance.
        appletInstance.setApplet(applet);
        appletInstance.getAppletEnvironment().setApplet(applet);
        
        setContextClassLoaderForAllThreads(appletInstance.getThreadGroup(), appletInstance.getClassLoader());

        return appletInstance;
    } catch (Exception ex) {
        throw launchError(new LaunchException(file, ex, R("LSFatal"), R("LCInit"), R("LInitApplet"), R("LInitAppletInfo")), appletInstance);
    }
}
 
開發者ID:GITNE,項目名稱:icedtea-web,代碼行數:55,代碼來源:Launcher.java

示例7: initApplet

import java.applet.AppletStub; //導入依賴的package包/類
/**
 * Call this method to initialize an applet from your launcher class 
 * <code>MyAppletLauncher.init()</code> method.
 * 
 * @param sClass class name in form "MyClass" for default package
 * or "com.abc.MyClass" for class in some package
 *
 * @param appletParent parent applet from a launcher.
 *
 * @throws Throwable wrapper for many exceptions thrown while applet 
 * instantiation and calling init() method.
 */
public void initApplet(String sClass, final JApplet appletParent) throws Throwable {
    Class<?> clazz = loadClass(sClass);
    logInfo(LogArea.CONFIG, "initApplet() --> %s.init(); Loader: %s", sClass, clazz.getClassLoader());
    applet = (JApplet)clazz.newInstance();
    applet.setStub(new AppletStub() {
        @Override
        public boolean isActive() {
            return appletParent.isActive();
        }
        @Override
        public URL getDocumentBase() {
            return appletParent.getDocumentBase();
        }
        @Override
        public URL getCodeBase() {
            return appletParent.getCodeBase();
        }
        @Override
        public String getParameter(String name) {
            return appletParent.getParameter(name);
        }
        @Override
        public AppletContext getAppletContext() {
            return appletParent.getAppletContext();
        }
        @Override
        public void appletResize(int width, int height) {
            appletParent.resize(width, height);
        }
    });
    applet.init();
    appletParent.setContentPane(applet.getContentPane());
}
 
開發者ID:open744,項目名稱:terramaster,代碼行數:46,代碼來源:JarClassLoader.java

示例8: getAppletStub

import java.applet.AppletStub; //導入依賴的package包/類
private static AppletStub getAppletStub(final AppletContext context, final URL codeBase, final URL docBase)
{

	return new AppletStub() {
		public boolean isActive()
		{
			return true;
		}

		public URL getDocumentBase()
		{
			return docBase;
		}

		public URL getCodeBase()
		{
			return codeBase;
		}

		public String getParameter(String name)
		{
			// Applet beans have no params.
			return null;
		}

		public AppletContext getAppletContext()
		{
			return context;
		}

		public void appletResize(int width, int height)
		{
			// Do nothing.
		}
	};
}
 
開發者ID:app55,項目名稱:app55-java,代碼行數:37,代碼來源:Beans.java

示例9: Applet

import java.applet.AppletStub; //導入依賴的package包/類
public Applet() {
   if(STANDALONE)
     setStub(new AppletStub() {
  public void appletResize(int width, int height) {}
  
  public AppletContext getAppletContext() {
    return null;
  }
  
  public URL getCodeBase() {
    return null;
  }
  
  public URL getDocumentBase() {
    return null;
  }
  
  public String getParameter(String key) {
    return (String)params.get(key);
  }
  
  public boolean isActive() {
    return active;
  }
});
   Preferences.addStore(new AppletPreferences(this));

   setBackground(new Color(0xC0C0C0));
 }
 
開發者ID:tamirhassan,項目名稱:pdfxtk,代碼行數:30,代碼來源:Applet.java

示例10: getStub

import java.applet.AppletStub; //導入依賴的package包/類
public AppletStub getStub() {
    return null;
}
 
開發者ID:Parabot,項目名稱:Parabot,代碼行數:4,代碼來源:ServerProvider.java


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