home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / sun / applet / AppletViewerPanel.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.3 KB  |  101 lines

  1. package sun.applet;
  2.  
  3. import java.applet.AppletContext;
  4. import java.awt.Component;
  5. import java.net.MalformedURLException;
  6. import java.net.URL;
  7. import java.util.Hashtable;
  8.  
  9. class AppletViewerPanel extends AppletPanel {
  10.    static boolean debug = false;
  11.    URL documentURL;
  12.    URL baseURL;
  13.    Hashtable atts;
  14.    private static final long serialVersionUID = 8890989370785545619L;
  15.  
  16.    AppletViewerPanel(URL var1, Hashtable var2) {
  17.       this.documentURL = var1;
  18.       this.atts = var2;
  19.       String var3 = this.getParameter("codebase");
  20.       if (var3 != null) {
  21.          if (!var3.endsWith("/")) {
  22.             var3 = var3 + "/";
  23.          }
  24.  
  25.          try {
  26.             this.baseURL = new URL(var1, var3);
  27.          } catch (MalformedURLException var8) {
  28.          }
  29.       }
  30.  
  31.       if (this.baseURL == null) {
  32.          String var4 = var1.getFile();
  33.          int var5 = var4.lastIndexOf(47);
  34.          if (var5 >= 0 && var5 < var4.length() - 1) {
  35.             try {
  36.                this.baseURL = new URL(var1, var4.substring(0, var5 + 1));
  37.             } catch (MalformedURLException var7) {
  38.             }
  39.          }
  40.       }
  41.  
  42.       if (this.baseURL == null) {
  43.          this.baseURL = var1;
  44.       }
  45.  
  46.    }
  47.  
  48.    public String getParameter(String var1) {
  49.       return (String)this.atts.get(var1.toLowerCase());
  50.    }
  51.  
  52.    public URL getDocumentBase() {
  53.       return this.documentURL;
  54.    }
  55.  
  56.    public URL getCodeBase() {
  57.       return this.baseURL;
  58.    }
  59.  
  60.    public int getWidth() {
  61.       String var1 = this.getParameter("width");
  62.       return var1 != null ? Integer.valueOf(var1) : 0;
  63.    }
  64.  
  65.    public int getHeight() {
  66.       String var1 = this.getParameter("height");
  67.       return var1 != null ? Integer.valueOf(var1) : 0;
  68.    }
  69.  
  70.    public String getCode() {
  71.       return this.getParameter("code");
  72.    }
  73.  
  74.    public String getJarFiles() {
  75.       return this.getParameter("archive");
  76.    }
  77.  
  78.    public String getSerializedObject() {
  79.       return this.getParameter("object");
  80.    }
  81.  
  82.    public AppletContext getAppletContext() {
  83.       return (AppletContext)((Component)this).getParent();
  84.    }
  85.  
  86.    static void debug(String var0) {
  87.       if (debug) {
  88.          System.err.println("AppletViewerPanel:::" + var0);
  89.       }
  90.  
  91.    }
  92.  
  93.    static void debug(String var0, Throwable var1) {
  94.       if (debug) {
  95.          var1.printStackTrace();
  96.          debug(var0);
  97.       }
  98.  
  99.    }
  100. }
  101.