home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / javax / swing / JRootPane.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  6.9 KB  |  286 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 java.security.AccessController;
  8. import javax.accessibility.Accessible;
  9. import javax.accessibility.AccessibleContext;
  10. import javax.swing.plaf.RootPaneUI;
  11. import sun.security.action.GetBooleanAction;
  12.  
  13. public class JRootPane extends JComponent implements Accessible {
  14.    private static final String uiClassID = "RootPaneUI";
  15.    private static final boolean LOG_DISABLE_TRUE_DOUBLE_BUFFERING = (Boolean)AccessController.doPrivileged(new GetBooleanAction("swing.logDoubleBufferingDisable"));
  16.    private static final boolean IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING = (Boolean)AccessController.doPrivileged(new GetBooleanAction("swing.ignoreDoubleBufferingDisable"));
  17.    public static final int NONE = 0;
  18.    public static final int FRAME = 1;
  19.    public static final int PLAIN_DIALOG = 2;
  20.    public static final int INFORMATION_DIALOG = 3;
  21.    public static final int ERROR_DIALOG = 4;
  22.    public static final int COLOR_CHOOSER_DIALOG = 5;
  23.    public static final int FILE_CHOOSER_DIALOG = 6;
  24.    public static final int QUESTION_DIALOG = 7;
  25.    public static final int WARNING_DIALOG = 8;
  26.    private int windowDecorationStyle;
  27.    protected JMenuBar menuBar;
  28.    protected Container contentPane;
  29.    protected JLayeredPane layeredPane;
  30.    protected Component glassPane;
  31.    protected JButton defaultButton;
  32.    /** @deprecated */
  33.    @Deprecated
  34.    protected DefaultAction defaultPressAction;
  35.    /** @deprecated */
  36.    @Deprecated
  37.    protected DefaultAction defaultReleaseAction;
  38.    boolean useTrueDoubleBuffering = true;
  39.  
  40.    public JRootPane() {
  41.       this.setGlassPane(this.createGlassPane());
  42.       this.setLayeredPane(this.createLayeredPane());
  43.       this.setContentPane(this.createContentPane());
  44.       this.setLayout(this.createRootLayout());
  45.       this.setDoubleBuffered(true);
  46.       this.updateUI();
  47.    }
  48.  
  49.    public void setDoubleBuffered(boolean var1) {
  50.       if (this.isDoubleBuffered() != var1) {
  51.          super.setDoubleBuffered(var1);
  52.          RepaintManager.currentManager(this).doubleBufferingChanged(this);
  53.       }
  54.  
  55.    }
  56.  
  57.    public int getWindowDecorationStyle() {
  58.       return this.windowDecorationStyle;
  59.    }
  60.  
  61.    public void setWindowDecorationStyle(int var1) {
  62.       if (var1 >= 0 && var1 <= 8) {
  63.          int var2 = this.getWindowDecorationStyle();
  64.          this.windowDecorationStyle = var1;
  65.          this.firePropertyChange("windowDecorationStyle", var2, var1);
  66.       } else {
  67.          throw new IllegalArgumentException("Invalid decoration style");
  68.       }
  69.    }
  70.  
  71.    public RootPaneUI getUI() {
  72.       return (RootPaneUI)this.ui;
  73.    }
  74.  
  75.    public void setUI(RootPaneUI var1) {
  76.       super.setUI(var1);
  77.    }
  78.  
  79.    public void updateUI() {
  80.       this.setUI((RootPaneUI)UIManager.getUI(this));
  81.    }
  82.  
  83.    public String getUIClassID() {
  84.       return "RootPaneUI";
  85.    }
  86.  
  87.    protected JLayeredPane createLayeredPane() {
  88.       JLayeredPane var1 = new JLayeredPane();
  89.       var1.setName(this.getName() + ".layeredPane");
  90.       return var1;
  91.    }
  92.  
  93.    protected Container createContentPane() {
  94.       JPanel var1 = new JPanel();
  95.       ((JComponent)var1).setName(this.getName() + ".contentPane");
  96.       ((JComponent)var1).setLayout(new 1(this));
  97.       return var1;
  98.    }
  99.  
  100.    protected Component createGlassPane() {
  101.       JPanel var1 = new JPanel();
  102.       ((JComponent)var1).setName(this.getName() + ".glassPane");
  103.       ((JComponent)var1).setVisible(false);
  104.       ((JPanel)var1).setOpaque(false);
  105.       return var1;
  106.    }
  107.  
  108.    protected LayoutManager createRootLayout() {
  109.       return new RootLayout(this);
  110.    }
  111.  
  112.    public void setJMenuBar(JMenuBar var1) {
  113.       if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
  114.          this.layeredPane.remove(this.menuBar);
  115.       }
  116.  
  117.       this.menuBar = var1;
  118.       if (this.menuBar != null) {
  119.          this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  120.       }
  121.  
  122.    }
  123.  
  124.    /** @deprecated */
  125.    @Deprecated
  126.    public void setMenuBar(JMenuBar var1) {
  127.       if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
  128.          this.layeredPane.remove(this.menuBar);
  129.       }
  130.  
  131.       this.menuBar = var1;
  132.       if (this.menuBar != null) {
  133.          this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
  134.       }
  135.  
  136.    }
  137.  
  138.    public JMenuBar getJMenuBar() {
  139.       return this.menuBar;
  140.    }
  141.  
  142.    /** @deprecated */
  143.    @Deprecated
  144.    public JMenuBar getMenuBar() {
  145.       return this.menuBar;
  146.    }
  147.  
  148.    public void setContentPane(Container var1) {
  149.       if (var1 == null) {
  150.          throw new IllegalComponentStateException("contentPane cannot be set to null.");
  151.       } else {
  152.          if (this.contentPane != null && this.contentPane.getParent() == this.layeredPane) {
  153.             this.layeredPane.remove(this.contentPane);
  154.          }
  155.  
  156.          this.contentPane = var1;
  157.          this.layeredPane.add(this.contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
  158.       }
  159.    }
  160.  
  161.    public Container getContentPane() {
  162.       return this.contentPane;
  163.    }
  164.  
  165.    public void setLayeredPane(JLayeredPane var1) {
  166.       if (var1 == null) {
  167.          throw new IllegalComponentStateException("layeredPane cannot be set to null.");
  168.       } else {
  169.          if (this.layeredPane != null && this.layeredPane.getParent() == this) {
  170.             this.remove(this.layeredPane);
  171.          }
  172.  
  173.          this.layeredPane = var1;
  174.          this.add(this.layeredPane, -1);
  175.       }
  176.    }
  177.  
  178.    public JLayeredPane getLayeredPane() {
  179.       return this.layeredPane;
  180.    }
  181.  
  182.    public void setGlassPane(Component var1) {
  183.       if (var1 == null) {
  184.          throw new NullPointerException("glassPane cannot be set to null.");
  185.       } else {
  186.          boolean var2 = false;
  187.          if (this.glassPane != null && this.glassPane.getParent() == this) {
  188.             this.remove(this.glassPane);
  189.             var2 = this.glassPane.isVisible();
  190.          }
  191.  
  192.          var1.setVisible(var2);
  193.          this.glassPane = var1;
  194.          this.add(this.glassPane, 0);
  195.          if (var2) {
  196.             this.repaint();
  197.          }
  198.  
  199.       }
  200.    }
  201.  
  202.    public Component getGlassPane() {
  203.       return this.glassPane;
  204.    }
  205.  
  206.    public boolean isValidateRoot() {
  207.       return true;
  208.    }
  209.  
  210.    public boolean isOptimizedDrawingEnabled() {
  211.       return !this.glassPane.isVisible();
  212.    }
  213.  
  214.    public void addNotify() {
  215.       SystemEventQueueUtilities.addRunnableCanvas(this);
  216.       super.addNotify();
  217.       this.enableEvents(8L);
  218.    }
  219.  
  220.    public void removeNotify() {
  221.       SystemEventQueueUtilities.removeRunnableCanvas(this);
  222.       super.removeNotify();
  223.    }
  224.  
  225.    public void setDefaultButton(JButton var1) {
  226.       JButton var2 = this.defaultButton;
  227.       if (var2 != var1) {
  228.          this.defaultButton = var1;
  229.          if (var2 != null) {
  230.             var2.repaint();
  231.          }
  232.  
  233.          if (var1 != null) {
  234.             var1.repaint();
  235.          }
  236.       }
  237.  
  238.       this.firePropertyChange("defaultButton", var2, var1);
  239.    }
  240.  
  241.    public JButton getDefaultButton() {
  242.       return this.defaultButton;
  243.    }
  244.  
  245.    final void setUseTrueDoubleBuffering(boolean var1) {
  246.       this.useTrueDoubleBuffering = var1;
  247.    }
  248.  
  249.    final boolean getUseTrueDoubleBuffering() {
  250.       return this.useTrueDoubleBuffering;
  251.    }
  252.  
  253.    final void disableTrueDoubleBuffering() {
  254.       if (this.useTrueDoubleBuffering && !IGNORE_DISABLE_TRUE_DOUBLE_BUFFERING) {
  255.          if (LOG_DISABLE_TRUE_DOUBLE_BUFFERING) {
  256.             System.out.println("Disabling true double buffering for " + this);
  257.             Thread.dumpStack();
  258.          }
  259.  
  260.          this.useTrueDoubleBuffering = false;
  261.          RepaintManager.currentManager(this).doubleBufferingChanged(this);
  262.       }
  263.  
  264.    }
  265.  
  266.    protected void addImpl(Component var1, Object var2, int var3) {
  267.       super.addImpl(var1, var2, var3);
  268.       if (this.glassPane != null && this.glassPane.getParent() == this && this.getComponent(0) != this.glassPane) {
  269.          this.add(this.glassPane, 0);
  270.       }
  271.  
  272.    }
  273.  
  274.    protected String paramString() {
  275.       return super.paramString();
  276.    }
  277.  
  278.    public AccessibleContext getAccessibleContext() {
  279.       if (this.accessibleContext == null) {
  280.          this.accessibleContext = new AccessibleJRootPane(this);
  281.       }
  282.  
  283.       return this.accessibleContext;
  284.    }
  285. }
  286.