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

  1. package javax.swing;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Container;
  5. import java.awt.IllegalComponentStateException;
  6. import java.awt.LayoutManager;
  7. import javax.accessibility.Accessible;
  8. import javax.accessibility.AccessibleContext;
  9. import javax.swing.plaf.RootPaneUI;
  10.  
  11. public class JRootPane extends JComponent implements Accessible {
  12.    private static final String uiClassID = "RootPaneUI";
  13.    private JComponent focusOwner;
  14.    private JComponent previousFocusOwner;
  15.    protected JMenuBar menuBar;
  16.    protected Container contentPane;
  17.    protected JLayeredPane layeredPane;
  18.    protected Component glassPane;
  19.    protected JButton defaultButton;
  20.    protected DefaultAction defaultPressAction;
  21.    protected DefaultAction defaultReleaseAction;
  22.  
  23.    public JRootPane() {
  24.       this.setGlassPane(this.createGlassPane());
  25.       this.setLayeredPane(this.createLayeredPane());
  26.       this.setContentPane(this.createContentPane());
  27.       ((Container)this).setLayout(this.createRootLayout());
  28.       ((JComponent)this).setDoubleBuffered(true);
  29.       this.updateUI();
  30.    }
  31.  
  32.    public RootPaneUI getUI() {
  33.       return (RootPaneUI)super.ui;
  34.    }
  35.  
  36.    public void setUI(RootPaneUI var1) {
  37.       super.setUI(var1);
  38.    }
  39.  
  40.    public void updateUI() {
  41.       this.setUI((RootPaneUI)UIManager.getUI(this));
  42.    }
  43.  
  44.    public String getUIClassID() {
  45.       return "RootPaneUI";
  46.    }
  47.  
  48.    protected JLayeredPane createLayeredPane() {
  49.       JLayeredPane var1 = new JLayeredPane();
  50.       ((Component)var1).setName(((Component)this).getName() + ".layeredPane");
  51.       return var1;
  52.    }
  53.  
  54.    protected Container createContentPane() {
  55.       JPanel var1 = new JPanel();
  56.       ((Component)var1).setName(((Component)this).getName() + ".contentPane");
  57.       ((Container)var1).setLayout(new 1(this));
  58.       return var1;
  59.    }
  60.  
  61.    protected Component createGlassPane() {
  62.       JPanel var1 = new JPanel();
  63.       ((Component)var1).setName(((Component)this).getName() + ".glassPane");
  64.       ((JComponent)var1).setVisible(false);
  65.       ((JPanel)var1).setOpaque(false);
  66.       return var1;
  67.    }
  68.  
  69.    protected LayoutManager createRootLayout() {
  70.       return new RootLayout(this);
  71.    }
  72.  
  73.    public void setJMenuBar(JMenuBar var1) {
  74.       if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
  75.          this.layeredPane.remove(this.menuBar);
  76.       }
  77.  
  78.       this.menuBar = var1;
  79.       if (this.menuBar != null) {
  80.          this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  81.       }
  82.  
  83.    }
  84.  
  85.    public void setMenuBar(JMenuBar var1) {
  86.       if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
  87.          this.layeredPane.remove(this.menuBar);
  88.       }
  89.  
  90.       this.menuBar = var1;
  91.       if (this.menuBar != null) {
  92.          this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  93.       }
  94.  
  95.    }
  96.  
  97.    public JMenuBar getJMenuBar() {
  98.       return this.menuBar;
  99.    }
  100.  
  101.    public JMenuBar getMenuBar() {
  102.       return this.menuBar;
  103.    }
  104.  
  105.    public void setContentPane(Container var1) {
  106.       if (var1 == null) {
  107.          throw new IllegalComponentStateException("contentPane cannot be set to null.");
  108.       } else {
  109.          if (this.contentPane != null && this.contentPane.getParent() == this.layeredPane) {
  110.             this.layeredPane.remove(this.contentPane);
  111.          }
  112.  
  113.          this.contentPane = var1;
  114.          this.layeredPane.add(this.contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
  115.       }
  116.    }
  117.  
  118.    public Container getContentPane() {
  119.       return this.contentPane;
  120.    }
  121.  
  122.    public void setLayeredPane(JLayeredPane var1) {
  123.       if (var1 == null) {
  124.          throw new IllegalComponentStateException("layeredPane cannot be set to null.");
  125.       } else {
  126.          if (this.layeredPane != null && this.layeredPane.getParent() == this) {
  127.             ((Container)this).remove(this.layeredPane);
  128.          }
  129.  
  130.          this.layeredPane = var1;
  131.          ((Container)this).add(this.layeredPane, -1);
  132.       }
  133.    }
  134.  
  135.    public JLayeredPane getLayeredPane() {
  136.       return this.layeredPane;
  137.    }
  138.  
  139.    public void setGlassPane(Component var1) {
  140.       if (var1 == null) {
  141.          throw new NullPointerException("glassPane cannot be set to null.");
  142.       } else {
  143.          boolean var2 = false;
  144.          if (this.glassPane != null && this.glassPane.getParent() == this) {
  145.             ((Container)this).remove(this.glassPane);
  146.             var2 = this.glassPane.isVisible();
  147.          }
  148.  
  149.          var1.setVisible(var2);
  150.          this.glassPane = var1;
  151.          ((Container)this).add(this.glassPane, 0);
  152.          if (var2) {
  153.             ((Component)this).repaint();
  154.          }
  155.  
  156.       }
  157.    }
  158.  
  159.    public Component getGlassPane() {
  160.       return this.glassPane;
  161.    }
  162.  
  163.    public boolean isFocusCycleRoot() {
  164.       return true;
  165.    }
  166.  
  167.    public boolean isValidateRoot() {
  168.       return true;
  169.    }
  170.  
  171.    public boolean isOptimizedDrawingEnabled() {
  172.       return !this.glassPane.isVisible();
  173.    }
  174.  
  175.    public void addNotify() {
  176.       SystemEventQueueUtilities.addRunnableCanvas(this);
  177.       super.addNotify();
  178.       ((Component)this).enableEvents(8L);
  179.    }
  180.  
  181.    public void removeNotify() {
  182.       SystemEventQueueUtilities.removeRunnableCanvas(this);
  183.       super.removeNotify();
  184.    }
  185.  
  186.    public void setDefaultButton(JButton var1) {
  187.       JButton var2 = this.defaultButton;
  188.       if (var2 != var1) {
  189.          this.defaultButton = var1;
  190.          if (var2 != null) {
  191.             ((Component)var2).repaint();
  192.          }
  193.  
  194.          if (var1 != null) {
  195.             ((Component)var1).repaint();
  196.          }
  197.       }
  198.  
  199.       ((JComponent)this).firePropertyChange("defaultButton", var2, var1);
  200.    }
  201.  
  202.    public JButton getDefaultButton() {
  203.       return this.defaultButton;
  204.    }
  205.  
  206.    protected void addImpl(Component var1, Object var2, int var3) {
  207.       super.addImpl(var1, var2, var3);
  208.       if (this.glassPane != null && this.glassPane.getParent() == this && ((Container)this).getComponent(0) != this.glassPane) {
  209.          ((Container)this).add(this.glassPane, 0);
  210.       }
  211.  
  212.    }
  213.  
  214.    void setCurrentFocusOwner(JComponent var1) {
  215.       this.focusOwner = var1;
  216.    }
  217.  
  218.    JComponent getCurrentFocusOwner() {
  219.       return this.focusOwner;
  220.    }
  221.  
  222.    void setPreviousFocusOwner(JComponent var1) {
  223.       this.previousFocusOwner = var1;
  224.    }
  225.  
  226.    JComponent getPreviousFocusOwner() {
  227.       return this.previousFocusOwner;
  228.    }
  229.  
  230.    protected String paramString() {
  231.       return super.paramString();
  232.    }
  233.  
  234.    public AccessibleContext getAccessibleContext() {
  235.       if (super.accessibleContext == null) {
  236.          super.accessibleContext = new AccessibleJRootPane(this);
  237.       }
  238.  
  239.       return super.accessibleContext;
  240.    }
  241. }
  242.