home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.IllegalComponentStateException;
- import java.awt.LayoutManager;
- import javax.accessibility.Accessible;
- import javax.accessibility.AccessibleContext;
- import javax.swing.plaf.RootPaneUI;
-
- public class JRootPane extends JComponent implements Accessible {
- private static final String uiClassID = "RootPaneUI";
- private JComponent focusOwner;
- private JComponent previousFocusOwner;
- protected JMenuBar menuBar;
- protected Container contentPane;
- protected JLayeredPane layeredPane;
- protected Component glassPane;
- protected JButton defaultButton;
- protected DefaultAction defaultPressAction;
- protected DefaultAction defaultReleaseAction;
-
- public JRootPane() {
- this.setGlassPane(this.createGlassPane());
- this.setLayeredPane(this.createLayeredPane());
- this.setContentPane(this.createContentPane());
- ((Container)this).setLayout(this.createRootLayout());
- ((JComponent)this).setDoubleBuffered(true);
- this.updateUI();
- }
-
- public RootPaneUI getUI() {
- return (RootPaneUI)super.ui;
- }
-
- public void setUI(RootPaneUI var1) {
- super.setUI(var1);
- }
-
- public void updateUI() {
- this.setUI((RootPaneUI)UIManager.getUI(this));
- }
-
- public String getUIClassID() {
- return "RootPaneUI";
- }
-
- protected JLayeredPane createLayeredPane() {
- JLayeredPane var1 = new JLayeredPane();
- ((Component)var1).setName(((Component)this).getName() + ".layeredPane");
- return var1;
- }
-
- protected Container createContentPane() {
- JPanel var1 = new JPanel();
- ((Component)var1).setName(((Component)this).getName() + ".contentPane");
- ((Container)var1).setLayout(new 1(this));
- return var1;
- }
-
- protected Component createGlassPane() {
- JPanel var1 = new JPanel();
- ((Component)var1).setName(((Component)this).getName() + ".glassPane");
- ((JComponent)var1).setVisible(false);
- ((JPanel)var1).setOpaque(false);
- return var1;
- }
-
- protected LayoutManager createRootLayout() {
- return new RootLayout(this);
- }
-
- public void setJMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
-
- public void setMenuBar(JMenuBar var1) {
- if (this.menuBar != null && this.menuBar.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.menuBar);
- }
-
- this.menuBar = var1;
- if (this.menuBar != null) {
- this.layeredPane.add(this.menuBar, JLayeredPane.FRAME_CONTENT_LAYER);
- }
-
- }
-
- public JMenuBar getJMenuBar() {
- return this.menuBar;
- }
-
- public JMenuBar getMenuBar() {
- return this.menuBar;
- }
-
- public void setContentPane(Container var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("contentPane cannot be set to null.");
- } else {
- if (this.contentPane != null && this.contentPane.getParent() == this.layeredPane) {
- this.layeredPane.remove(this.contentPane);
- }
-
- this.contentPane = var1;
- this.layeredPane.add(this.contentPane, JLayeredPane.FRAME_CONTENT_LAYER);
- }
- }
-
- public Container getContentPane() {
- return this.contentPane;
- }
-
- public void setLayeredPane(JLayeredPane var1) {
- if (var1 == null) {
- throw new IllegalComponentStateException("layeredPane cannot be set to null.");
- } else {
- if (this.layeredPane != null && this.layeredPane.getParent() == this) {
- ((Container)this).remove(this.layeredPane);
- }
-
- this.layeredPane = var1;
- ((Container)this).add(this.layeredPane, -1);
- }
- }
-
- public JLayeredPane getLayeredPane() {
- return this.layeredPane;
- }
-
- public void setGlassPane(Component var1) {
- if (var1 == null) {
- throw new NullPointerException("glassPane cannot be set to null.");
- } else {
- boolean var2 = false;
- if (this.glassPane != null && this.glassPane.getParent() == this) {
- ((Container)this).remove(this.glassPane);
- var2 = this.glassPane.isVisible();
- }
-
- var1.setVisible(var2);
- this.glassPane = var1;
- ((Container)this).add(this.glassPane, 0);
- if (var2) {
- ((Component)this).repaint();
- }
-
- }
- }
-
- public Component getGlassPane() {
- return this.glassPane;
- }
-
- public boolean isFocusCycleRoot() {
- return true;
- }
-
- public boolean isValidateRoot() {
- return true;
- }
-
- public boolean isOptimizedDrawingEnabled() {
- return !this.glassPane.isVisible();
- }
-
- public void addNotify() {
- SystemEventQueueUtilities.addRunnableCanvas(this);
- super.addNotify();
- ((Component)this).enableEvents(8L);
- }
-
- public void removeNotify() {
- SystemEventQueueUtilities.removeRunnableCanvas(this);
- super.removeNotify();
- }
-
- public void setDefaultButton(JButton var1) {
- JButton var2 = this.defaultButton;
- if (var2 != var1) {
- this.defaultButton = var1;
- if (var2 != null) {
- ((Component)var2).repaint();
- }
-
- if (var1 != null) {
- ((Component)var1).repaint();
- }
- }
-
- ((JComponent)this).firePropertyChange("defaultButton", var2, var1);
- }
-
- public JButton getDefaultButton() {
- return this.defaultButton;
- }
-
- protected void addImpl(Component var1, Object var2, int var3) {
- super.addImpl(var1, var2, var3);
- if (this.glassPane != null && this.glassPane.getParent() == this && ((Container)this).getComponent(0) != this.glassPane) {
- ((Container)this).add(this.glassPane, 0);
- }
-
- }
-
- void setCurrentFocusOwner(JComponent var1) {
- this.focusOwner = var1;
- }
-
- JComponent getCurrentFocusOwner() {
- return this.focusOwner;
- }
-
- void setPreviousFocusOwner(JComponent var1) {
- this.previousFocusOwner = var1;
- }
-
- JComponent getPreviousFocusOwner() {
- return this.previousFocusOwner;
- }
-
- protected String paramString() {
- return super.paramString();
- }
-
- public AccessibleContext getAccessibleContext() {
- if (super.accessibleContext == null) {
- super.accessibleContext = new AccessibleJRootPane(this);
- }
-
- return super.accessibleContext;
- }
- }
-