home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / JApplet.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  4.9 KB  |  162 lines

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