本文整理汇总了Java中javax.swing.JApplet.setContentPane方法的典型用法代码示例。如果您正苦于以下问题:Java JApplet.setContentPane方法的具体用法?Java JApplet.setContentPane怎么用?Java JApplet.setContentPane使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JApplet
的用法示例。
在下文中一共展示了JApplet.setContentPane方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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());
}
示例2: 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());
}
示例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());
}