java.applet.Applet.getAppletContext()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中java.applet.Applet.getAppletContext()方法的一些代码示例,展示了Applet.getAppletContext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Applet.getAppletContext()方法的具体详情如下:
包路径:java.applet.Applet
类名称:Applet
方法名:getAppletContext

Applet.getAppletContext介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

public static JSObject getWindow(Applet applet) {
  if (applet != null) {
    AppletContext context = applet.getAppletContext();

    if (context instanceof JSContext) {
      JSContext jsContext = (JSContext)context;
      JSObject jsObject = jsContext.getJSObject();

      if (jsObject != null) {
        return jsObject;
      }
    }
  }

  throw new JSException();
}

代码示例来源:origin: org.opencadc/cadc-app-kit

public AppletContext getAppletContext() { return applet.getAppletContext(); }

代码示例来源:origin: stackoverflow.com

import java.applet.*;
import java.net.*;

public class InJava4 extends Applet{
 public void init(){
  String msg = "Hello from Java (using javascript alert)";
  try {
   getAppletContext().showDocument
    (new URL("javascript:doAlert(\"" + msg +"\")"));
   }
  catch (MalformedURLException me) { }
 }
}

代码示例来源:origin: stackoverflow.com

import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.UnknownHostException;
import javax.swing.JApplet;
public class PegaIP extends JApplet {
  @Override
  public void init() {
    try {
      getAppletContext().showDocument (new URL("javascript:UpdateIP(\"" + InetAddress.getLocalHost().getHostAddress() + "\")"));
    } catch (UnknownHostException | MalformedURLException e) {
      System.err.println("Ocorreu erro na criação da GUI");
    }
  }
}

代码示例来源:origin: stackoverflow.com

import java.applet.*;
import java.awt.Graphics;
import java.net.MalformedURLException;
import java.net.URL;

public class AppletExample extends Applet
{

public void init() {

try {
getAppletContext().showDocument(new URL("http://www.google.com"), "_blank");//This is new tab/
getAppletContext().showDocument(new URL("http://www.google.com"), "_parent");//This is in the parent tab/
}
catch (MalformedURLException ex) {
System.out.println(ex.getMessage());
}
}

public void paint( Graphics g ) {

g.drawString("Go Google", 0,100);
}

}

代码示例来源:origin: IanDarwin/javasrc

/** When the button is pressed, go for it! */
public void mousePressed(MouseEvent e) {
  parent.showStatus("Showing document at URL " + u);
  parent.getAppletContext().showDocument(u);
  // No error checking on showDocument() -- the
  // browser will honk at the user if the link
  // is invalid. We should open "u" ourselves,
  // check the open, and close it. Or not...
}
/** NotUsed */

代码示例来源:origin: stackoverflow.com

import java.applet.Applet;
import java.io.File;
import java.io.FilenameFilter;
import java.net.MalformedURLException;
import java.net.URL;

public class Main extends Applet {
  private static final long serialVersionUID = 1L;

  @Override
  public void init() {
    File[] lib = getMP3Files("E:/Music/BollywoodMusic"); // pass your directory name here
    for(File s:lib) {
      try { getAppletContext().showDocument(new URL("javascript:addSong('"+s.getName()+"')")); } catch(MalformedURLException me) {}
    }

    try {getAppletContext().showDocument(new URL("javascript:init()"));}
    catch (MalformedURLException me) {}
  }

  public static File[] getMP3Files(String directoryName) {
    File directory = new File(directoryName);
    return directory.listFiles(new FilenameFilter() {
      public boolean accept(File directory, String fileName) {
        return fileName.endsWith(".mp3"); } });
  }

}

代码示例来源:origin: org.activecomponents.jadex/jadex-commons-gui

applet.getAppletContext().showDocument(new URL(url), "BrowserLauncher");

代码示例来源:origin: stackoverflow.com

String appletContext = getAppletContext().toString();
if (appletContext.startsWith("sun.applet.AppletViewer"))
  theBrowser = "APPLETVIEWER";

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime

if (topComponent instanceof Applet) {
  try {
    Enumeration<Applet> applets = ((Applet) topComponent).getAppletContext().getApplets();
    while (applets.hasMoreElements()) {
      containers.add(applets.nextElement());

代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime-swing-help

if (topComponent instanceof Applet) {
  try {
    Enumeration<Applet> applets = ((Applet) topComponent).getAppletContext().getApplets();
    while (applets.hasMoreElements()) {
      containers.add(applets.nextElement());

代码示例来源:origin: javax.help/javahelp

if (topComponent instanceof Applet) {
  try {
    Enumeration applets = ((Applet)topComponent).getAppletContext().getApplets();
    while (applets.hasMoreElements()) {
      containers.add(applets.nextElement());

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-help

if (topComponent instanceof Applet) {
  try {
    Enumeration<Applet> applets = ((Applet) topComponent).getAppletContext().getApplets();
    while (applets.hasMoreElements()) {
      containers.add(applets.nextElement());

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing

if (topComponent instanceof Applet) {
  try {
    Enumeration<Applet> applets = ((Applet) topComponent).getAppletContext().getApplets();
    while (applets.hasMoreElements()) {
      containers.add(applets.nextElement());

代码示例来源:origin: stackoverflow.com

currentApplet.getAppletContext().showDocument(new URL(address));
} catch (Exception ex) {

代码示例来源:origin: stackoverflow.com

getAppletContext().showDocument(failurePageURL, "_self");

代码示例来源:origin: stackoverflow.com

if (this.url != null) getAppletContext().showStatus("Link: " + this.url.toString());
return true;
if (this.url != null) getAppletContext().showStatus("");
return true;
if (this.url != null) getAppletContext().showDocument(this.url, this.target);
return true;

代码示例来源:origin: stackoverflow.com

try {
  URL url = new URL(getDocumentBase(), newpage);
  getAppletContext().showDocument(url);

相关文章