home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / JWindow.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  3.4 KB  |  125 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.LayoutManager;
  7. import java.awt.Window;
  8. import javax.accessibility.Accessible;
  9. import javax.accessibility.AccessibleContext;
  10.  
  11. public class JWindow extends Window implements Accessible, RootPaneContainer {
  12.    protected JRootPane rootPane;
  13.    protected boolean rootPaneCheckingEnabled;
  14.    protected AccessibleContext accessibleContext;
  15.  
  16.    public JWindow() {
  17.       this((Frame)null);
  18.    }
  19.  
  20.    public JWindow(Frame var1) {
  21.       super(var1 == null ? SwingUtilities.getSharedOwnerFrame() : var1);
  22.       this.rootPaneCheckingEnabled = false;
  23.       this.accessibleContext = null;
  24.       this.windowInit();
  25.    }
  26.  
  27.    protected void addImpl(Component var1, Object var2, int var3) {
  28.       if (this.isRootPaneCheckingEnabled()) {
  29.          throw this.createRootPaneException("add");
  30.       } else {
  31.          super.addImpl(var1, var2, var3);
  32.       }
  33.    }
  34.  
  35.    protected JRootPane createRootPane() {
  36.       return new JRootPane();
  37.    }
  38.  
  39.    private Error createRootPaneException(String var1) {
  40.       String var2 = this.getClass().getName();
  41.       return new Error("Do not use " + var2 + "." + var1 + "() use " + var2 + ".getContentPane()." + var1 + "() instead");
  42.    }
  43.  
  44.    public AccessibleContext getAccessibleContext() {
  45.       if (this.accessibleContext == null) {
  46.          this.accessibleContext = new AccessibleJWindow(this);
  47.       }
  48.  
  49.       return this.accessibleContext;
  50.    }
  51.  
  52.    public Container getContentPane() {
  53.       return this.getRootPane().getContentPane();
  54.    }
  55.  
  56.    public Component getGlassPane() {
  57.       return this.getRootPane().getGlassPane();
  58.    }
  59.  
  60.    public JLayeredPane getLayeredPane() {
  61.       return this.getRootPane().getLayeredPane();
  62.    }
  63.  
  64.    public JRootPane getRootPane() {
  65.       return this.rootPane;
  66.    }
  67.  
  68.    protected boolean isRootPaneCheckingEnabled() {
  69.       return this.rootPaneCheckingEnabled;
  70.    }
  71.  
  72.    protected String paramString() {
  73.       String var1 = this.rootPaneCheckingEnabled ? "true" : "false";
  74.       return super.paramString() + ",rootPaneCheckingEnabled=" + var1;
  75.    }
  76.  
  77.    public void setContentPane(Container var1) {
  78.       this.getRootPane().setContentPane(var1);
  79.    }
  80.  
  81.    public void setGlassPane(Component var1) {
  82.       this.getRootPane().setGlassPane(var1);
  83.    }
  84.  
  85.    public void setLayeredPane(JLayeredPane var1) {
  86.       this.getRootPane().setLayeredPane(var1);
  87.    }
  88.  
  89.    public void setLayout(LayoutManager var1) {
  90.       if (this.isRootPaneCheckingEnabled()) {
  91.          throw this.createRootPaneException("setLayout");
  92.       } else {
  93.          super.setLayout(var1);
  94.       }
  95.    }
  96.  
  97.    protected void setRootPane(JRootPane var1) {
  98.       if (this.rootPane != null) {
  99.          ((Container)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.    protected void setRootPaneCheckingEnabled(boolean var1) {
  117.       this.rootPaneCheckingEnabled = var1;
  118.    }
  119.  
  120.    protected void windowInit() {
  121.       this.setRootPane(this.createRootPane());
  122.       this.setRootPaneCheckingEnabled(true);
  123.    }
  124. }
  125.