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 / JWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  3.2 KB  |  153 lines

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