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 / javax / swing / JFrame.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  4.6 KB  |  215 lines

  1. package javax.swing;
  2.  
  3. import java.awt.AWTEvent;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Frame;
  7. import java.awt.Graphics;
  8. import java.awt.GraphicsConfiguration;
  9. import java.awt.LayoutManager;
  10. import java.awt.Window;
  11. import java.awt.event.InputEvent;
  12. import java.awt.event.KeyEvent;
  13. import java.awt.event.WindowEvent;
  14. import javax.accessibility.Accessible;
  15. import javax.accessibility.AccessibleContext;
  16.  
  17. public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer {
  18.    public static final int EXIT_ON_CLOSE = 3;
  19.    private int defaultCloseOperation = 1;
  20.    protected JRootPane rootPane;
  21.    protected boolean rootPaneCheckingEnabled = false;
  22.    protected AccessibleContext accessibleContext = null;
  23.  
  24.    public JFrame() {
  25.       this.frameInit();
  26.    }
  27.  
  28.    public JFrame(GraphicsConfiguration var1) {
  29.       super(var1);
  30.       this.frameInit();
  31.    }
  32.  
  33.    public JFrame(String var1) {
  34.       super(var1);
  35.       this.frameInit();
  36.    }
  37.  
  38.    public JFrame(String var1, GraphicsConfiguration var2) {
  39.       super(var1, var2);
  40.       this.frameInit();
  41.    }
  42.  
  43.    protected void frameInit() {
  44.       ((Component)this).enableEvents(72L);
  45.       this.setRootPane(this.createRootPane());
  46.       ((Component)this).setBackground(UIManager.getColor("control"));
  47.       this.setRootPaneCheckingEnabled(true);
  48.    }
  49.  
  50.    protected JRootPane createRootPane() {
  51.       return new JRootPane();
  52.    }
  53.  
  54.    protected void processKeyEvent(KeyEvent var1) {
  55.       super.processKeyEvent(var1);
  56.       if (!((InputEvent)var1).isConsumed()) {
  57.          JComponent.processKeyBindingsForAllComponents(var1, this, ((AWTEvent)var1).getID() == 401);
  58.       }
  59.  
  60.    }
  61.  
  62.    protected void processWindowEvent(WindowEvent var1) {
  63.       super.processWindowEvent(var1);
  64.       if (((AWTEvent)var1).getID() == 201) {
  65.          switch (this.defaultCloseOperation) {
  66.             case 0:
  67.             default:
  68.                break;
  69.             case 1:
  70.                ((Component)this).setVisible(false);
  71.                break;
  72.             case 2:
  73.                ((Component)this).setVisible(false);
  74.                ((Window)this).dispose();
  75.                break;
  76.             case 3:
  77.                System.exit(0);
  78.          }
  79.       }
  80.  
  81.    }
  82.  
  83.    public void setDefaultCloseOperation(int var1) {
  84.       this.defaultCloseOperation = var1;
  85.    }
  86.  
  87.    public int getDefaultCloseOperation() {
  88.       return this.defaultCloseOperation;
  89.    }
  90.  
  91.    public void update(Graphics var1) {
  92.       ((Container)this).paint(var1);
  93.    }
  94.  
  95.    public void setJMenuBar(JMenuBar var1) {
  96.       this.getRootPane().setMenuBar(var1);
  97.    }
  98.  
  99.    public JMenuBar getJMenuBar() {
  100.       return this.getRootPane().getMenuBar();
  101.    }
  102.  
  103.    protected boolean isRootPaneCheckingEnabled() {
  104.       return this.rootPaneCheckingEnabled;
  105.    }
  106.  
  107.    protected void setRootPaneCheckingEnabled(boolean var1) {
  108.       this.rootPaneCheckingEnabled = var1;
  109.    }
  110.  
  111.    private Error createRootPaneException(String var1) {
  112.       String var2 = this.getClass().getName();
  113.       return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
  114.    }
  115.  
  116.    protected void addImpl(Component var1, Object var2, int var3) {
  117.       if (this.isRootPaneCheckingEnabled()) {
  118.          throw this.createRootPaneException("add");
  119.       } else {
  120.          super.addImpl(var1, var2, var3);
  121.       }
  122.    }
  123.  
  124.    public void remove(Component var1) {
  125.       if (var1 == this.rootPane) {
  126.          super.remove(var1);
  127.       } else {
  128.          this.getContentPane().remove(var1);
  129.       }
  130.  
  131.    }
  132.  
  133.    public void setLayout(LayoutManager var1) {
  134.       if (this.isRootPaneCheckingEnabled()) {
  135.          throw this.createRootPaneException("setLayout");
  136.       } else {
  137.          super.setLayout(var1);
  138.       }
  139.    }
  140.  
  141.    public JRootPane getRootPane() {
  142.       return this.rootPane;
  143.    }
  144.  
  145.    protected void setRootPane(JRootPane var1) {
  146.       if (this.rootPane != null) {
  147.          this.remove(this.rootPane);
  148.       }
  149.  
  150.       this.rootPane = var1;
  151.       if (this.rootPane != null) {
  152.          boolean var2 = this.isRootPaneCheckingEnabled();
  153.  
  154.          try {
  155.             this.setRootPaneCheckingEnabled(false);
  156.             ((Container)this).add(this.rootPane, "Center");
  157.          } finally {
  158.             this.setRootPaneCheckingEnabled(var2);
  159.          }
  160.       }
  161.  
  162.    }
  163.  
  164.    public Container getContentPane() {
  165.       return this.getRootPane().getContentPane();
  166.    }
  167.  
  168.    public void setContentPane(Container var1) {
  169.       this.getRootPane().setContentPane(var1);
  170.    }
  171.  
  172.    public JLayeredPane getLayeredPane() {
  173.       return this.getRootPane().getLayeredPane();
  174.    }
  175.  
  176.    public void setLayeredPane(JLayeredPane var1) {
  177.       this.getRootPane().setLayeredPane(var1);
  178.    }
  179.  
  180.    public Component getGlassPane() {
  181.       return this.getRootPane().getGlassPane();
  182.    }
  183.  
  184.    public void setGlassPane(Component var1) {
  185.       this.getRootPane().setGlassPane(var1);
  186.    }
  187.  
  188.    protected String paramString() {
  189.       String var1;
  190.       if (this.defaultCloseOperation == 1) {
  191.          var1 = "HIDE_ON_CLOSE";
  192.       } else if (this.defaultCloseOperation == 2) {
  193.          var1 = "DISPOSE_ON_CLOSE";
  194.       } else if (this.defaultCloseOperation == 0) {
  195.          var1 = "DO_NOTHING_ON_CLOSE";
  196.       } else if (this.defaultCloseOperation == 3) {
  197.          var1 = "EXIT_ON_CLOSE";
  198.       } else {
  199.          var1 = "";
  200.       }
  201.  
  202.       String var2 = this.rootPane != null ? this.rootPane.toString() : "";
  203.       String var3 = this.rootPaneCheckingEnabled ? "true" : "false";
  204.       return super.paramString() + ",defaultCloseOperation=" + var1 + ",rootPane=" + var2 + ",rootPaneCheckingEnabled=" + var3;
  205.    }
  206.  
  207.    public AccessibleContext getAccessibleContext() {
  208.       if (this.accessibleContext == null) {
  209.          this.accessibleContext = new AccessibleJFrame(this);
  210.       }
  211.  
  212.       return this.accessibleContext;
  213.    }
  214. }
  215.