KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > multi > MultiOptionPaneUI


1 /*
2  * @(#)MultiOptionPaneUI.java 1.25 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7 package javax.swing.plaf.multi;
8
9 import java.util.Vector JavaDoc;
10 import javax.swing.plaf.OptionPaneUI JavaDoc;
11 import javax.swing.JOptionPane JavaDoc;
12 import javax.swing.plaf.ComponentUI JavaDoc;
13 import javax.swing.JComponent JavaDoc;
14 import java.awt.Graphics JavaDoc;
15 import java.awt.Dimension JavaDoc;
16 import javax.accessibility.Accessible JavaDoc;
17
18 /**
19  * A multiplexing UI used to combine <code>OptionPaneUI</code>s.
20  *
21  * <p>This file was automatically generated by AutoMulti.
22  *
23  * @version 1.25 12/19/03 17:39:36
24  * @author Otto Multey
25  */

26 public class MultiOptionPaneUI extends OptionPaneUI JavaDoc {
27
28     /**
29      * The vector containing the real UIs. This is populated
30      * in the call to <code>createUI</code>, and can be obtained by calling
31      * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
32      * obtained from the default look and feel.
33      */

34     protected Vector JavaDoc uis = new Vector JavaDoc();
35
36 ////////////////////
37
// Common UI methods
38
////////////////////
39

40     /**
41      * Returns the list of UIs associated with this multiplexing UI. This
42      * allows processing of the UIs by an application aware of multiplexing
43      * UIs on components.
44      */

45     public ComponentUI JavaDoc[] getUIs() {
46         return MultiLookAndFeel.uisToArray(uis);
47     }
48
49 ////////////////////
50
// OptionPaneUI methods
51
////////////////////
52

53     /**
54      * Invokes the <code>selectInitialValue</code> method on each UI handled by this object.
55      */

56     public void selectInitialValue(JOptionPane JavaDoc a) {
57         for (int i = 0; i < uis.size(); i++) {
58             ((OptionPaneUI JavaDoc) (uis.elementAt(i))).selectInitialValue(a);
59         }
60     }
61
62     /**
63      * Invokes the <code>containsCustomComponents</code> method on each UI handled by this object.
64      *
65      * @return the value obtained from the first UI, which is
66      * the UI obtained from the default <code>LookAndFeel</code>
67      */

68     public boolean containsCustomComponents(JOptionPane JavaDoc a) {
69         boolean returnValue =
70             ((OptionPaneUI JavaDoc) (uis.elementAt(0))).containsCustomComponents(a);
71         for (int i = 1; i < uis.size(); i++) {
72             ((OptionPaneUI JavaDoc) (uis.elementAt(i))).containsCustomComponents(a);
73         }
74         return returnValue;
75     }
76
77 ////////////////////
78
// ComponentUI methods
79
////////////////////
80

81     /**
82      * Invokes the <code>contains</code> method on each UI handled by this object.
83      *
84      * @return the value obtained from the first UI, which is
85      * the UI obtained from the default <code>LookAndFeel</code>
86      */

87     public boolean contains(JComponent JavaDoc a, int b, int c) {
88         boolean returnValue =
89             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
90         for (int i = 1; i < uis.size(); i++) {
91             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
92         }
93         return returnValue;
94     }
95
96     /**
97      * Invokes the <code>update</code> method on each UI handled by this object.
98      */

99     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
100         for (int i = 0; i < uis.size(); i++) {
101             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
102         }
103     }
104
105     /**
106      * Returns a multiplexing UI instance if any of the auxiliary
107      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
108      * UI object obtained from the default <code>LookAndFeel</code>.
109      */

110     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
111         ComponentUI JavaDoc mui = new MultiOptionPaneUI JavaDoc();
112         return MultiLookAndFeel.createUIs(mui,
113                                           ((MultiOptionPaneUI JavaDoc) mui).uis,
114                                           a);
115     }
116
117     /**
118      * Invokes the <code>installUI</code> method on each UI handled by this object.
119      */

120     public void installUI(JComponent JavaDoc a) {
121         for (int i = 0; i < uis.size(); i++) {
122             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
123         }
124     }
125
126     /**
127      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
128      */

129     public void uninstallUI(JComponent JavaDoc a) {
130         for (int i = 0; i < uis.size(); i++) {
131             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
132         }
133     }
134
135     /**
136      * Invokes the <code>paint</code> method on each UI handled by this object.
137      */

138     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
139         for (int i = 0; i < uis.size(); i++) {
140             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
141         }
142     }
143
144     /**
145      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
146      *
147      * @return the value obtained from the first UI, which is
148      * the UI obtained from the default <code>LookAndFeel</code>
149      */

150     public Dimension JavaDoc getPreferredSize(JComponent JavaDoc a) {
151         Dimension JavaDoc returnValue =
152             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
153         for (int i = 1; i < uis.size(); i++) {
154             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
155         }
156         return returnValue;
157     }
158
159     /**
160      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
161      *
162      * @return the value obtained from the first UI, which is
163      * the UI obtained from the default <code>LookAndFeel</code>
164      */

165     public Dimension JavaDoc getMinimumSize(JComponent JavaDoc a) {
166         Dimension JavaDoc returnValue =
167             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMinimumSize(a);
168         for (int i = 1; i < uis.size(); i++) {
169             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMinimumSize(a);
170         }
171         return returnValue;
172     }
173
174     /**
175      * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
176      *
177      * @return the value obtained from the first UI, which is
178      * the UI obtained from the default <code>LookAndFeel</code>
179      */

180     public Dimension JavaDoc getMaximumSize(JComponent JavaDoc a) {
181         Dimension JavaDoc returnValue =
182             ((ComponentUI JavaDoc) (uis.elementAt(0))).getMaximumSize(a);
183         for (int i = 1; i < uis.size(); i++) {
184             ((ComponentUI JavaDoc) (uis.elementAt(i))).getMaximumSize(a);
185         }
186         return returnValue;
187     }
188
189     /**
190      * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
191      *
192      * @return the value obtained from the first UI, which is
193      * the UI obtained from the default <code>LookAndFeel</code>
194      */

195     public int getAccessibleChildrenCount(JComponent JavaDoc a) {
196         int returnValue =
197             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChildrenCount(a);
198         for (int i = 1; i < uis.size(); i++) {
199             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChildrenCount(a);
200         }
201         return returnValue;
202     }
203
204     /**
205      * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object.
206      *
207      * @return the value obtained from the first UI, which is
208      * the UI obtained from the default <code>LookAndFeel</code>
209      */

210     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
211         Accessible JavaDoc returnValue =
212             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
213         for (int i = 1; i < uis.size(); i++) {
214             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
215         }
216         return returnValue;
217     }
218 }
219
Popular Tags