/[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.5.2.2 by gnu_andrew, Tue Aug 2 20:12:38 2005 UTC revision 1.5.2.3 by gnu_andrew, Wed Nov 2 00:43:58 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        // TODO: Implement this properly.
120      }
121    
122      /**
123       * Uninstalls this UI from the root pane. This calls
124       * {@link #uninstallDefaults}, {@link #uninstallComponents},
125       * {@link #uninstallListeners}, {@link #uninstallKeyboardActions}
126       * in this order.
127       *
128       * @param c the root pane to uninstall the UI from
129       */
130      public void uninstallUI(JComponent c)
131      {
132        super.uninstallUI(c);
133        if (c instanceof JRootPane)
134          {
135            JRootPane rp = (JRootPane) c;
136            uninstallDefaults(rp);
137            uninstallComponents(rp);
138            uninstallListeners(rp);
139            uninstallKeyboardActions(rp);
140          }
141      }
142    
143      /**
144       * Uninstalls the look and feel defaults that have been installed in
145       * {@link #installDefaults}.
146       *
147       * @param rp the root pane to uninstall the defaults from
148       */
149      protected void uninstallDefaults(JRootPane rp)
150      {
151        // We do nothing here.
152      }
153    
154      /**
155       * Uninstalls look and feel components from the root pane.
156       *
157       * @param rp the root pane to uninstall the components from
158       */
159      protected void uninstallComponents(JRootPane rp)
160      {
161        // We do nothing here.
162      }
163    
164      /**
165       * Uninstalls any look and feel specific listeners from the root pane.
166       *
167       * @param rp the root pane to uninstall the listeners from
168       */
169      protected void uninstallListeners(JRootPane rp)
170      {
171        rp.removePropertyChangeListener(this);
172      }
173    
174      /**
175       * Uninstalls look and feel keyboard actions from the root pane.
176       *
177       * @param rp the root pane to uninstall the keyboard actions from
178       */
179      protected void uninstallKeyboardActions(JRootPane rp)
180      {
181        // We do nothing here.
182    }    }
183  }  }

Legend:
Removed from v.1.5.2.2  
changed lines
  Added in v.1.5.2.3

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