home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1998 January / PCO0198.ISO / 1&1 / java.z / java_301 / java / applet / Applet.class (.txt) next >
Encoding:
Java Class File  |  1996-10-20  |  3.2 KB  |  116 lines

  1. package java.applet;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Dimension;
  5. import java.awt.Image;
  6. import java.awt.Panel;
  7. import java.net.MalformedURLException;
  8. import java.net.URL;
  9.  
  10. public class Applet extends Panel {
  11.    private AppletStub stub;
  12.  
  13.    public final void setStub(AppletStub stub) {
  14.       this.stub = stub;
  15.    }
  16.  
  17.    public boolean isActive() {
  18.       return this.stub.isActive();
  19.    }
  20.  
  21.    public URL getDocumentBase() {
  22.       return this.stub.getDocumentBase();
  23.    }
  24.  
  25.    public URL getCodeBase() {
  26.       return this.stub.getCodeBase();
  27.    }
  28.  
  29.    public String getParameter(String name) {
  30.       return this.stub.getParameter(name);
  31.    }
  32.  
  33.    public AppletContext getAppletContext() {
  34.       return this.stub.getAppletContext();
  35.    }
  36.  
  37.    public void resize(int width, int height) {
  38.       Dimension d = ((Component)this).size();
  39.       if (d.width != width || d.height != height) {
  40.          super.resize(width, height);
  41.          if (this.stub != null) {
  42.             this.stub.appletResize(width, height);
  43.          }
  44.       }
  45.  
  46.    }
  47.  
  48.    public void resize(Dimension d) {
  49.       this.resize(d.width, d.height);
  50.    }
  51.  
  52.    public void showStatus(String msg) {
  53.       this.getAppletContext().showStatus(msg);
  54.    }
  55.  
  56.    public Image getImage(URL url) {
  57.       return this.getAppletContext().getImage(url);
  58.    }
  59.  
  60.    public Image getImage(URL url, String name) {
  61.       try {
  62.          return this.getImage(new URL(url, name));
  63.       } catch (MalformedURLException var3) {
  64.          return null;
  65.       }
  66.    }
  67.  
  68.    public AudioClip getAudioClip(URL url) {
  69.       return this.getAppletContext().getAudioClip(url);
  70.    }
  71.  
  72.    public AudioClip getAudioClip(URL url, String name) {
  73.       try {
  74.          return this.getAudioClip(new URL(url, name));
  75.       } catch (MalformedURLException var3) {
  76.          return null;
  77.       }
  78.    }
  79.  
  80.    public String getAppletInfo() {
  81.       return null;
  82.    }
  83.  
  84.    public String[][] getParameterInfo() {
  85.       return null;
  86.    }
  87.  
  88.    public void play(URL url) {
  89.       AudioClip clip = this.getAudioClip(url);
  90.       if (clip != null) {
  91.          clip.play();
  92.       }
  93.  
  94.    }
  95.  
  96.    public void play(URL url, String name) {
  97.       AudioClip clip = this.getAudioClip(url, name);
  98.       if (clip != null) {
  99.          clip.play();
  100.       }
  101.  
  102.    }
  103.  
  104.    public void init() {
  105.    }
  106.  
  107.    public void start() {
  108.    }
  109.  
  110.    public void stop() {
  111.    }
  112.  
  113.    public void destroy() {
  114.    }
  115. }
  116.