home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / JApplet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.8 KB  |  161 lines

  1. package javax.swing;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.AWTEvent;
  5. import java.awt.BorderLayout;
  6. import java.awt.Color;
  7. import java.awt.Component;
  8. import java.awt.Container;
  9. import java.awt.Graphics;
  10. import java.awt.LayoutManager;
  11. import java.awt.event.InputEvent;
  12. import java.awt.event.KeyEvent;
  13. import javax.accessibility.Accessible;
  14. import javax.accessibility.AccessibleContext;
  15.  
  16. public class JApplet extends Applet implements Accessible, RootPaneContainer {
  17.    protected JRootPane rootPane;
  18.    protected boolean rootPaneCheckingEnabled = false;
  19.    protected AccessibleContext accessibleContext = null;
  20.  
  21.    public JApplet() {
  22.       TimerQueue var1 = TimerQueue.sharedInstance();
  23.       if (var1 != null) {
  24.          synchronized(var1) {
  25.             if (!var1.running) {
  26.                var1.start();
  27.             }
  28.          }
  29.       }
  30.  
  31.       ((Component)this).setForeground(Color.black);
  32.       ((Component)this).setBackground(Color.white);
  33.       this.setLayout(new BorderLayout());
  34.       this.setRootPane(this.createRootPane());
  35.       this.setRootPaneCheckingEnabled(true);
  36.    }
  37.  
  38.    protected JRootPane createRootPane() {
  39.       return new JRootPane();
  40.    }
  41.  
  42.    protected void processKeyEvent(KeyEvent var1) {
  43.       super.processKeyEvent(var1);
  44.       if (!((InputEvent)var1).isConsumed()) {
  45.          JComponent.processKeyBindingsForAllComponents(var1, this, ((AWTEvent)var1).getID() == 401);
  46.       }
  47.  
  48.    }
  49.  
  50.    public void update(Graphics var1) {
  51.       ((Container)this).paint(var1);
  52.    }
  53.  
  54.    public void setJMenuBar(JMenuBar var1) {
  55.       this.getRootPane().setMenuBar(var1);
  56.    }
  57.  
  58.    public JMenuBar getJMenuBar() {
  59.       return this.getRootPane().getMenuBar();
  60.    }
  61.  
  62.    protected boolean isRootPaneCheckingEnabled() {
  63.       return this.rootPaneCheckingEnabled;
  64.    }
  65.  
  66.    protected void setRootPaneCheckingEnabled(boolean var1) {
  67.       this.rootPaneCheckingEnabled = var1;
  68.    }
  69.  
  70.    private Error createRootPaneException(String var1) {
  71.       String var2 = this.getClass().getName();
  72.       return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
  73.    }
  74.  
  75.    protected void addImpl(Component var1, Object var2, int var3) {
  76.       if (this.isRootPaneCheckingEnabled()) {
  77.          throw this.createRootPaneException("add");
  78.       } else {
  79.          super.addImpl(var1, var2, var3);
  80.       }
  81.    }
  82.  
  83.    public void remove(Component var1) {
  84.       if (var1 == this.rootPane) {
  85.          super.remove(var1);
  86.       } else {
  87.          this.getContentPane().remove(var1);
  88.       }
  89.  
  90.    }
  91.  
  92.    public void setLayout(LayoutManager var1) {
  93.       if (this.isRootPaneCheckingEnabled()) {
  94.          throw this.createRootPaneException("setLayout");
  95.       } else {
  96.          super.setLayout(var1);
  97.       }
  98.    }
  99.  
  100.    public JRootPane getRootPane() {
  101.       return this.rootPane;
  102.    }
  103.  
  104.    protected void setRootPane(JRootPane var1) {
  105.       if (this.rootPane != null) {
  106.          this.remove(this.rootPane);
  107.       }
  108.  
  109.       this.rootPane = var1;
  110.       if (this.rootPane != null) {
  111.          boolean var2 = this.isRootPaneCheckingEnabled();
  112.  
  113.          try {
  114.             this.setRootPaneCheckingEnabled(false);
  115.             ((Container)this).add(this.rootPane, "Center");
  116.          } finally {
  117.             this.setRootPaneCheckingEnabled(var2);
  118.          }
  119.       }
  120.  
  121.    }
  122.  
  123.    public Container getContentPane() {
  124.       return this.getRootPane().getContentPane();
  125.    }
  126.  
  127.    public void setContentPane(Container var1) {
  128.       this.getRootPane().setContentPane(var1);
  129.    }
  130.  
  131.    public JLayeredPane getLayeredPane() {
  132.       return this.getRootPane().getLayeredPane();
  133.    }
  134.  
  135.    public void setLayeredPane(JLayeredPane var1) {
  136.       this.getRootPane().setLayeredPane(var1);
  137.    }
  138.  
  139.    public Component getGlassPane() {
  140.       return this.getRootPane().getGlassPane();
  141.    }
  142.  
  143.    public void setGlassPane(Component var1) {
  144.       this.getRootPane().setGlassPane(var1);
  145.    }
  146.  
  147.    protected String paramString() {
  148.       String var1 = this.rootPane != null ? this.rootPane.toString() : "";
  149.       String var2 = this.rootPaneCheckingEnabled ? "true" : "false";
  150.       return super.paramString() + ",rootPane=" + var1 + ",rootPaneCheckingEnabled=" + var2;
  151.    }
  152.  
  153.    public AccessibleContext getAccessibleContext() {
  154.       if (this.accessibleContext == null) {
  155.          this.accessibleContext = new AccessibleJApplet(this);
  156.       }
  157.  
  158.       return this.accessibleContext;
  159.    }
  160. }
  161.