本文整理汇总了Java中java.applet.AppletContext类的典型用法代码示例。如果您正苦于以下问题:Java AppletContext类的具体用法?Java AppletContext怎么用?Java AppletContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AppletContext类属于java.applet包,在下文中一共展示了AppletContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gotoTargetPage
import java.applet.AppletContext; //导入依赖的package包/类
private void gotoTargetPage() {
String targetPageParam = getParameter(TARGET_PAGE_PARAM);
if (null != targetPageParam) {
AppletContext appletContext = getAppletContext();
URL documentBase = getDocumentBase();
try {
URL targetUrl = new URL(documentBase, targetPageParam);
addDetailMessage("Navigating to: " + targetUrl);
appletContext.showDocument(targetUrl, "_self");
} catch (MalformedURLException e) {
addDetailMessage("URL error: " + e.getMessage());
}
} else {
// Java WebStart
System.exit(0);
}
}
示例2: gotoCancelPage
import java.applet.AppletContext; //导入依赖的package包/类
private boolean gotoCancelPage() {
String cancelPageParam = getParameter(CANCEL_PAGE_PARAM);
if (null == cancelPageParam) {
return false;
}
AppletContext appletContext = getAppletContext();
URL documentBase = getDocumentBase();
try {
URL targetUrl = new URL(documentBase, cancelPageParam);
addDetailMessage("Navigating to: " + targetUrl);
appletContext.showDocument(targetUrl, "_self");
} catch (MalformedURLException e) {
addDetailMessage("URL error: " + e.getMessage());
}
return true;
}
示例3: close
import java.applet.AppletContext; //导入依赖的package包/类
/**
* Closes the applet. This method can be implemented by invoking
* <code>getAppletContext().showDocument(...)</code>.
*/
protected void close() {
AppletContext appletContext;
try {
appletContext = getAppletContext();
} catch (Throwable e) {
appletContext = null;
}
if (appletContext == null) {
System.exit(0);
} else {
try {
appletContext.showDocument(new URL(getDocumentBase(), getParameter("PageURL")));
} catch (MalformedURLException ex) {
ex.printStackTrace();
}
}
}
示例4: openPage
import java.applet.AppletContext; //导入依赖的package包/类
private void openPage() {
try {
if(Settings.getInstance().isApplet()) {
// Running on applet, so open in a new window
//System.out.println("open in new window");
AppletContext a = Settings.getInstance().getApplet().
getAppletContext();
a.showDocument(new URL(targetURL), "_blank");
} else {
// Running on desktop
URI uri = new URI(targetURL);
Desktop.getDesktop().browse(uri);
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: getParams
import java.applet.AppletContext; //导入依赖的package包/类
private HashMap<String, String> getParams() {
log.info("Fetching parameters for the XMLEnricher...");
HashMap<String, String> params = new HashMap<String, String>();
Configurator conf = Configurator.getInstance();
AppletContext appletContext = conf.APPLET_CONTEXT;
if (appletContext != null) {
Enumeration<Applet> applets = appletContext.getApplets();
if (applets != null) {
while (applets.hasMoreElements()) {
Applet applet = applets.nextElement();
for (String specKey : paramsToFetch) {
String value = null;
int it = 0;
while ((value = applet.getParameter(specKey + it)) != null) {
params.put(specKey+it, value);
log.info("Parameter found - value: " + value + " - key: " + specKey+it);
it++;
}
}
}
}
}
log.info("Fetching parameters for the XMLEnricher done!");
return params;
}
示例6: setStatus
import java.applet.AppletContext; //导入依赖的package包/类
private void setStatus(String s)
{
if (!isApplet())
{
clientGUI.setStatus(s);
return;
}
try
{
AppletContext context = getAppletContext();
context.showDocument(new URL("javascript:showStatus('"+s+"');"));
}
catch (Exception e)
{
e.printStackTrace();
}
}
示例7: getAppletStub
import java.applet.AppletContext; //导入依赖的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.
}
};
}
示例8: BeansAppletStub
import java.applet.AppletContext; //导入依赖的package包/类
BeansAppletStub(Applet target,
AppletContext context, URL codeBase,
URL docBase) {
this.target = target;
this.context = context;
this.codeBase = codeBase;
this.docBase = docBase;
}
示例9: initApplet
import java.applet.AppletContext; //导入依赖的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());
}
示例10: gotoAuthorizationErrorPage
import java.applet.AppletContext; //导入依赖的package包/类
private void gotoAuthorizationErrorPage() {
String authorizationErrorPage = getParameter(AUTHORIZATION_ERROR_PAGE_PARAM);
if (null == authorizationErrorPage) {
return;
}
AppletContext appletContext = getAppletContext();
URL documentBase = getDocumentBase();
try {
URL targetUrl = new URL(documentBase, authorizationErrorPage);
addDetailMessage("Navigating to: " + targetUrl);
appletContext.showDocument(targetUrl, "_self");
} catch (MalformedURLException e) {
addDetailMessage("URL error: " + e.getMessage());
}
}
示例11: getAppletContext
import java.applet.AppletContext; //导入依赖的package包/类
@Override
public AppletContext getAppletContext() {
if (false == this.securityConditionTrustedWebApp) {
throw new SecurityException("web application not trusted");
}
return super.getAppletContext();
}
示例12: initApplet
import java.applet.AppletContext; //导入依赖的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());
}
示例13: getAppletContext
import java.applet.AppletContext; //导入依赖的package包/类
@Override
public AppletContext getAppletContext() {
if (getParent() instanceof AppletContext) {
return super.getAppletContext();
}
return ((NetxPanel)this).getAppInst().getAppletEnvironment();
}
示例14: showDocument
import java.applet.AppletContext; //导入依赖的package包/类
public static boolean showDocument(AppletContext appcontext,
String sUrl)
{
try {
appcontext.showDocument(new URL(sUrl),"");
} catch (Exception e) {
return true;
}
return false;
}
示例15: LinkBorder
import java.applet.AppletContext; //导入依赖的package包/类
public LinkBorder(Component component, AppletContext context, String text, Color c, int thickness)
{
super(c, thickness);
this.text = text;
targetComponent = component;
targetComponent.addMouseListener(this);
targetComponent.addMouseMotionListener(this);
appletContext = context;
highlight = false;
targetBounds = new Rectangle();
}