本文整理匯總了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");
}
示例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);
}
}
示例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.
}
};
}
示例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());
}
示例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());
}
示例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);
}
}
示例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());
}
示例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.
}
};
}
示例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));
}
示例10: getStub
import java.applet.AppletStub; //導入依賴的package包/類
public AppletStub getStub() {
return null;
}