/[classpath]/classpath/javax/swing/plaf/basic/BasicRootPaneUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicRootPaneUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by mark, Sat Jul 2 20:32:50 2005 UTC revision 1.9 by rabbit78, Thu Oct 6 13:53:26 2005 UTC
# Line 42  import java.beans.PropertyChangeEvent; Line 42  import java.beans.PropertyChangeEvent;
42  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
43    
44  import javax.swing.JComponent;  import javax.swing.JComponent;
45    import javax.swing.JRootPane;
46  import javax.swing.UIManager;  import javax.swing.UIManager;
47  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
48  import javax.swing.plaf.RootPaneUI;  import javax.swing.plaf.RootPaneUI;
# Line 56  public class BasicRootPaneUI extends Roo Line 57  public class BasicRootPaneUI extends Roo
57    
58    public void installUI(JComponent c)    public void installUI(JComponent c)
59    {    {
     c.setBackground(UIManager.getColor("control"));  
60      super.installUI(c);      super.installUI(c);
61        if (c instanceof JRootPane)
62          {
63            JRootPane rp = (JRootPane) c;
64            installDefaults(rp);
65            installComponents(rp);
66            installListeners(rp);
67            installKeyboardActions(rp);
68          }
69      }
70    
71      /**
72       * Installs the look and feel defaults for JRootPane.
73       *
74       * @param rp the root pane to install the defaults to
75       */
76      protected void installDefaults(JRootPane rp)
77      {
78        // Is this ok?
79        rp.setBackground(UIManager.getColor("control"));
80      }
81    
82      /**
83       * Installs additional look and feel components to the root pane.
84       *
85       * @param rp the root pane to install the components to
86       */
87      protected void installComponents(JRootPane rp)
88      {
89        // All components are initialized in the JRootPane constructor, and since
90        // the createXXXPane methods are protected, I see no reasonable way,
91        // and no need to initialize them here. This method is here anyway
92        // for compatibility and to provide the necessary hooks to subclasses.
93      }
94    
95      /**
96       * Installs any look and feel specific listeners on the root pane.
97       *
98       * @param rp the root pane to install the listeners to
99       */
100      protected void installListeners(JRootPane rp)
101      {
102        rp.addPropertyChangeListener(this);
103      }
104    
105      /**
106       * Installs look and feel keyboard actions on the root pane.
107       *
108       * @param rp the root pane to install the keyboard actions to
109       */
110      protected void installKeyboardActions(JRootPane rp)
111      {
112        // We currently do not install any keyboard actions here.
113        // This method is here anyway for compatibility and to provide
114        // the necessary hooks to subclasses.
115    }    }
116    
117    public void propertyChange(PropertyChangeEvent event)    public void propertyChange(PropertyChangeEvent event)
118    {    {
119    }    }
120    
121      /**
122       * Uninstalls this UI from the root pane. This calls
123       * {@link #uninstallDefaults}, {@link #uninstallComponents},
124       * {@link #uninstallListeners}, {@link #uninstallKeyboardActions}
125       * in this order.
126       *
127       * @param c the root pane to uninstall the UI from
128       */
129      public void uninstallUI(JComponent c)
130      {
131        super.uninstallUI(c);
132        if (c instanceof JRootPane)
133          {
134            JRootPane rp = (JRootPane) c;
135            uninstallDefaults(rp);
136            uninstallComponents(rp);
137            uninstallListeners(rp);
138            uninstallKeyboardActions(rp);
139          }
140      }
141    
142      /**
143       * Uninstalls the look and feel defaults that have been installed in
144       * {@link #installDefaults}.
145       *
146       * @param rp the root pane to uninstall the defaults from
147       */
148      protected void uninstallDefaults(JRootPane rp)
149      {
150        // We do nothing here.
151      }
152    
153      /**
154       * Uninstalls look and feel components from the root pane.
155       *
156       * @param rp the root pane to uninstall the components from
157       */
158      protected void uninstallComponents(JRootPane rp)
159      {
160        // We do nothing here.
161      }
162    
163      /**
164       * Uninstalls any look and feel specific listeners from the root pane.
165       *
166       * @param rp the root pane to uninstall the listeners from
167       */
168      protected void uninstallListeners(JRootPane rp)
169      {
170        rp.removePropertyChangeListener(this);
171      }
172    
173      /**
174       * Uninstalls look and feel keyboard actions from the root pane.
175       *
176       * @param rp the root pane to uninstall the keyboard actions from
177       */
178      protected void uninstallKeyboardActions(JRootPane rp)
179      {
180        // We do nothing here.
181      }
182  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26