home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2001 December / dppcpro1201.iso / Extras / maple / Viewer / WebEQ / MMLViewerInstall.cab / MMLViewerApplet.cab / webeq3 / app / Handler.class (.txt) < prev    next >
Encoding:
Java Class File  |  2001-05-24  |  2.6 KB  |  114 lines

  1. package webeq3.app;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.Color;
  5. import java.awt.Component;
  6. import java.awt.Dimension;
  7. import java.awt.image.ImageObserver;
  8. import java.net.MalformedURLException;
  9. import java.net.URL;
  10. import webeq3.editor.EditorFrame;
  11.  
  12. public class Handler {
  13.    boolean is_applet = false;
  14.    Applet my_applet;
  15.    Component main;
  16.    String[] argv;
  17.    String defaultStatus = "";
  18.  
  19.    public void setParameters(Applet var1) {
  20.       this.my_applet = var1;
  21.       this.is_applet = true;
  22.    }
  23.  
  24.    public void setParameters(Component var1, String[] var2) {
  25.       this.main = var1;
  26.       this.argv = var2;
  27.    }
  28.  
  29.    public void setDefaultStatus(String var1) {
  30.       this.defaultStatus = var1;
  31.    }
  32.  
  33.    public Color getBackground() {
  34.       return this.is_applet ? this.my_applet.getBackground() : this.main.getBackground();
  35.    }
  36.  
  37.    public Color getForeground() {
  38.       return this.is_applet ? this.my_applet.getForeground() : this.main.getForeground();
  39.    }
  40.  
  41.    public ImageObserver getImageObserver() {
  42.       return (ImageObserver)(this.is_applet ? this.my_applet : this.main);
  43.    }
  44.  
  45.    public Component getComponent() {
  46.       return (Component)(this.is_applet ? this.my_applet : this.main);
  47.    }
  48.  
  49.    public String getParameter(String var1) {
  50.       return this.is_applet ? this.my_applet.getParameter(var1) : null;
  51.    }
  52.  
  53.    public Dimension size() {
  54.       return this.is_applet ? this.my_applet.size() : this.main.size();
  55.    }
  56.  
  57.    public void showStatus(String var1) {
  58.       if (this.is_applet) {
  59.          this.my_applet.showStatus(var1);
  60.       } else if (this.main != null && this.main instanceof EditorFrame) {
  61.          ((EditorFrame)this.main).setPromptString(var1);
  62.       }
  63.  
  64.    }
  65.  
  66.    public void showDefaultStatus() {
  67.       if (this.is_applet) {
  68.          this.my_applet.showStatus(this.defaultStatus);
  69.       }
  70.  
  71.    }
  72.  
  73.    public URL getCodeBase() {
  74.       if (this.is_applet) {
  75.          return this.my_applet.getCodeBase();
  76.       } else {
  77.          try {
  78.             return new URL("file:" + System.getProperty("user.dir") + "/");
  79.          } catch (MalformedURLException var2) {
  80.             ((Throwable)var2).printStackTrace();
  81.             return null;
  82.          }
  83.       }
  84.    }
  85.  
  86.    public URL getDocumentBase() {
  87.       if (this.is_applet) {
  88.          return this.my_applet.getDocumentBase();
  89.       } else {
  90.          try {
  91.             return new URL("file:" + System.getProperty("user.dir") + "/");
  92.          } catch (MalformedURLException var2) {
  93.             ((Throwable)var2).printStackTrace();
  94.             return null;
  95.          }
  96.       }
  97.    }
  98.  
  99.    public void showDocument(URL var1) {
  100.       if (this.is_applet) {
  101.          this.my_applet.getAppletContext().showDocument(var1);
  102.       }
  103.    }
  104.  
  105.    public void repaint() {
  106.       if (this.is_applet) {
  107.          this.my_applet.repaint();
  108.       } else {
  109.          this.main.repaint();
  110.       }
  111.  
  112.    }
  113. }
  114.