Imported GNU Classpath 0.90
[official-gcc.git] / libjava / classpath / javax / swing / plaf / basic / BasicRootPaneUI.java
blob28e3b67c1a5488c23284ab94792e817acedfbc92
1 /* BasicRootPaneUI.java --
2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing.plaf.basic;
41 import java.beans.PropertyChangeEvent;
42 import java.beans.PropertyChangeListener;
44 import javax.swing.JComponent;
45 import javax.swing.JRootPane;
46 import javax.swing.plaf.ComponentUI;
47 import javax.swing.plaf.RootPaneUI;
49 public class BasicRootPaneUI extends RootPaneUI
50 implements PropertyChangeListener
52 public static ComponentUI createUI(JComponent x)
54 return new BasicRootPaneUI();
57 public void installUI(JComponent c)
59 super.installUI(c);
60 if (c instanceof JRootPane)
62 JRootPane rp = (JRootPane) c;
63 installDefaults(rp);
64 installComponents(rp);
65 installListeners(rp);
66 installKeyboardActions(rp);
70 /**
71 * Installs the look and feel defaults for JRootPane.
73 * @param rp the root pane to install the defaults to
75 protected void installDefaults(JRootPane rp)
77 // TODO: What to do here, if anything? (might be a hook method)
80 /**
81 * Installs additional look and feel components to the root pane.
83 * @param rp the root pane to install the components to
85 protected void installComponents(JRootPane rp)
87 // All components are initialized in the JRootPane constructor, and since
88 // the createXXXPane methods are protected, I see no reasonable way,
89 // and no need to initialize them here. This method is here anyway
90 // for compatibility and to provide the necessary hooks to subclasses.
93 /**
94 * Installs any look and feel specific listeners on the root pane.
96 * @param rp the root pane to install the listeners to
98 protected void installListeners(JRootPane rp)
100 rp.addPropertyChangeListener(this);
104 * Installs look and feel keyboard actions on the root pane.
106 * @param rp the root pane to install the keyboard actions to
108 protected void installKeyboardActions(JRootPane rp)
110 // We currently do not install any keyboard actions here.
111 // This method is here anyway for compatibility and to provide
112 // the necessary hooks to subclasses.
115 public void propertyChange(PropertyChangeEvent event)
117 // TODO: Implement this properly.
121 * Uninstalls this UI from the root pane. This calls
122 * {@link #uninstallDefaults}, {@link #uninstallComponents},
123 * {@link #uninstallListeners}, {@link #uninstallKeyboardActions}
124 * in this order.
126 * @param c the root pane to uninstall the UI from
128 public void uninstallUI(JComponent c)
130 super.uninstallUI(c);
131 if (c instanceof JRootPane)
133 JRootPane rp = (JRootPane) c;
134 uninstallDefaults(rp);
135 uninstallComponents(rp);
136 uninstallListeners(rp);
137 uninstallKeyboardActions(rp);
142 * Uninstalls the look and feel defaults that have been installed in
143 * {@link #installDefaults}.
145 * @param rp the root pane to uninstall the defaults from
147 protected void uninstallDefaults(JRootPane rp)
149 // We do nothing here.
153 * Uninstalls look and feel components from the root pane.
155 * @param rp the root pane to uninstall the components from
157 protected void uninstallComponents(JRootPane rp)
159 // We do nothing here.
163 * Uninstalls any look and feel specific listeners from the root pane.
165 * @param rp the root pane to uninstall the listeners from
167 protected void uninstallListeners(JRootPane rp)
169 rp.removePropertyChangeListener(this);
173 * Uninstalls look and feel keyboard actions from the root pane.
175 * @param rp the root pane to uninstall the keyboard actions from
177 protected void uninstallKeyboardActions(JRootPane rp)
179 // We do nothing here.