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


Java JApplet.setStub方法代碼示例

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


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

示例1: run

import javax.swing.JApplet; //導入方法依賴的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: run

import javax.swing.JApplet; //導入方法依賴的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();
   }
}
 
開發者ID:luox12,項目名稱:onecmdb,代碼行數:26,代碼來源:AppletLaunch.java

示例3: initApplet

import javax.swing.JApplet; //導入方法依賴的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

示例4: initApplet

import javax.swing.JApplet; //導入方法依賴的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

示例5: initApplet

import javax.swing.JApplet; //導入方法依賴的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


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