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

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

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

Applet.getDocumentBase介绍

暂无

代码示例

代码示例来源:origin: webwork/webwork-jira

/**
* Create a new dispatcher with an applet providing the URL.
*
* The servlet needs to be deployed with the name "dispatch".
*/
public ClientDispatcher(Applet anApplet, String context)
 throws java.net.MalformedURLException
{
 this( new URL(anApplet.getDocumentBase(),
    context+DISPATCHER).toExternalForm());
}

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

// <applet code=MyLocation width=400 height=30></applet>
import javax.swing.*;

public class MyLocation extends JApplet {

  @Override
  public void init() {
    add( new JLabel(getDocumentBase().toString()));
  }
}

代码示例来源:origin: org.jboss.openjdk-orb/openjdk-orb

public String get( String name ) {
    String value = resultProps.getProperty(name);
    if (value == null)
      return null ;
    try {
      URL url = new URL( app.getDocumentBase(), value ) ;
      return url.toExternalForm() ;
    } catch (java.net.MalformedURLException exc) {
      // Just preserve the original (malformed) value:
      // the error will be handled later.
      return value ;
    }
  }
} ;

代码示例来源:origin: net.imagej/ij

static String loadAppletProps(InputStream f, Applet applet) {
  if (f==null)
    return PROPS_NAME+" not found in ij.jar";
  try {
    props.load(f);
    f.close();
  }
  catch (IOException e) {return("Error loading "+PROPS_NAME);}
  try {
    URL url = new URL(applet.getDocumentBase(), "images/");
    imagesURL = url.toString();
  }
  catch (Exception e) {}
  return null;
}

代码示例来源:origin: imagej/ImageJA

static String loadAppletProps(InputStream f, Applet applet) {
  if (f==null)
    return PROPS_NAME+" not found in ij.jar";
  try {
    props.load(f);
    f.close();
  }
  catch (IOException e) {return("Error loading "+PROPS_NAME);}
  try {
    URL url = new URL(applet.getDocumentBase(), "images/");
    imagesURL = url.toString();
  }
  catch (Exception e) {}
  return null;
}

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

import java.applet.Applet;
import java.awt.Graphics;

public class MyImage extends Applet{
  private java.awt.Image image1;
  public void init(){
    image1=getImage(getDocumentBase(),"android.png");
  }
  public void paint(Graphics g){
    g.drawImage(image1,0,0,this);
  }
}

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

import java.awt.*;  
import java.applet.*;  

public class DisplayImage extends Applet {  

 Image picture;  

 public void init() {  
  picture = getImage(getDocumentBase(),"res/tileset_terrain.png");  
 }  

 public void paint(Graphics g) {  
  g.drawImage(picture, 30,30, this);  
 }  

 }

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

URL pic = new URL(getDocumentBase(), "images.jpg");
  aang = ImageIO.read(pic);
} catch(Exception e) {

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

import java.awt.GridLayout;
import javax.swing.*;

// <applet code=WhereAmIApplet width=500 height=50></applet>
public class WhereAmIApplet extends JApplet {

  @Override
  public void init() {
    setLayout(new GridLayout(0,1,5,5));
    add(new JLabel("Document Base: " + getDocumentBase()));
    add(new JLabel("Code Base: " + getCodeBase()));
  }
}

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

import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
import java.util.Random;

public class Cards10 extends Applet
{

  String deckCards[] = {"c1.gif", "c2.gif", "c3.gif", "c4.gif", "c5.gif", "c6.gif", "c7.gif", "c8.gif", "c9.gif", "c10.gif", "cj.gif", "ck.gif", "cq.gif", "s1.gif", "s2.gif", "s3.gif", "s4.gif", "s5.gif", "s6.gif", "s7.gif", "s8.gif", "s9.gif", "s10.gif", "sj.gif", "sk.gif", "sq.gif", "d1.gif", "d2.gif", "d3.gif", "d4.gif", "d5.gif", "d6.gif", "d7.gif", "d8.gif", "d9.gif", "d10.gif", "dj.gif", "dk.gif", "dq.gif", "h1.gif", "h2.gif", "h3.gif", "h4.gif", "h5.gif", "h6.gif", "h7.gif", "h8.gif", "h9.gif", "h10.gif", "hj.gif", "hk.gif", "hq.gif"};
  Random rand = new Random();
  Image[] card = new Image[10];

  public void init()
  {
    for(int k = 0; k < 11; k++){
      int r = rand.nextInt(51);
      card[k] = getImage(getDocumentBase(), deckCards[r]);
    }
    flipped = getImage(getDocumentBase(), "b1fv.gif");
  }

  public void paint(Graphics g)
  {
    g.drawImage(flipped, 10, 10, this);
    for(int i = 1;i<6;i++) g.drawImage(card[i], 10 + (40*i), 10, this);
    for(int i = 6;i<10;i++) g.drawImage(card[i], 10 + (40*(i-6)), 125, this);
  }
}

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

import java.awt.*;
import javax.swing.JApplet;

public class LastAirBender extends JApplet {

  private static final long serialVersionUID = 1L;
  private Image aang;

  @Override
  public void init() {
    aang = getImage(getDocumentBase(), getParameter("images.jpg"));
  }

  @Override
  public void paint(Graphics g) {
    g.drawImage(aang, 100, 100, this);
  }
}

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

import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;

import javax.swing.JApplet;

public class JavaProject extends JApplet {
  Image img;

  public void init() {
    img = getImage(getDocumentBase(), "images/222.png");
    // Please ensure that 222.png is placed under bin/images folder directly
  }

  @Override
  public void paint(Graphics g) {
    update(g);
  }

  @Override
  public void update(Graphics g) {
    g.drawImage(img, 20, 20, this);

  }

}

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

import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class Test extends Applet {

Image img;

public void init() {
  setSize(700, 700);

  img = getImage(getDocumentBase(), "dancer1.gif");

}

public void update(Graphics g) {
  g.drawImage(img, 140, 200, this);
}

public void paint(Graphics g) {
  update(g);
}

}

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

mt.addImage(trumpet,1);
mt.addImage(walking,1);
spoopy = getAudioClip(getDocumentBase(),"spoopy.wav");
spoopy.loop();

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

kick = this.getAudioClip(getDocumentBase(), "kick.wav");
snare = this.getAudioClip(getDocumentBase(), "snare.wav");

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

URL url = getDocumentBase();
audioClip = getAudioClip(url, "music/JButton.wav");

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

url = getDocumentBase();
img = ImageIO.read(url);
scary = getImage(url,"scary.gif");
spoopy = getAudioClip(getDocumentBase(),"spoopy.wav");
spoopy.loop();

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

clip  = getAudioClip(getDocumentBase(), "sound/woof.wav");

代码示例来源:origin: org.apache.xalan/com.springsource.org.apache.xalan

m_documentBase = this.getDocumentBase();

代码示例来源:origin: org.apache.karaf.bundles/org.apache.karaf.bundles.xalan-2.7.1

m_documentBase = this.getDocumentBase();

相关文章