KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)MultiMenuItemUI.java 1.28 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.MenuItemUI JavaDoc;
11 import javax.swing.plaf.ButtonUI 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>MenuItemUI</code>s.
20  *
21  * <p>This file was automatically generated by AutoMulti.
22  *
23  * @version 1.28 12/19/03 17:39:35
24  * @author Otto Multey
25  */

26 public class MultiMenuItemUI extends MenuItemUI 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
// MenuItemUI methods
51
////////////////////
52

53 ////////////////////
54
// ButtonUI methods
55
////////////////////
56

57 ////////////////////
58
// ComponentUI methods
59
////////////////////
60

61     /**
62      * Invokes the <code>contains</code> method on each UI handled by this object.
63      *
64      * @return the value obtained from the first UI, which is
65      * the UI obtained from the default <code>LookAndFeel</code>
66      */

67     public boolean contains(JComponent JavaDoc a, int b, int c) {
68         boolean returnValue =
69             ((ComponentUI JavaDoc) (uis.elementAt(0))).contains(a,b,c);
70         for (int i = 1; i < uis.size(); i++) {
71             ((ComponentUI JavaDoc) (uis.elementAt(i))).contains(a,b,c);
72         }
73         return returnValue;
74     }
75
76     /**
77      * Invokes the <code>update</code> method on each UI handled by this object.
78      */

79     public void update(Graphics JavaDoc a, JComponent JavaDoc b) {
80         for (int i = 0; i < uis.size(); i++) {
81             ((ComponentUI JavaDoc) (uis.elementAt(i))).update(a,b);
82         }
83     }
84
85     /**
86      * Returns a multiplexing UI instance if any of the auxiliary
87      * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
88      * UI object obtained from the default <code>LookAndFeel</code>.
89      */

90     public static ComponentUI JavaDoc createUI(JComponent JavaDoc a) {
91         ComponentUI JavaDoc mui = new MultiMenuItemUI JavaDoc();
92         return MultiLookAndFeel.createUIs(mui,
93                                           ((MultiMenuItemUI JavaDoc) mui).uis,
94                                           a);
95     }
96
97     /**
98      * Invokes the <code>installUI</code> method on each UI handled by this object.
99      */

100     public void installUI(JComponent JavaDoc a) {
101         for (int i = 0; i < uis.size(); i++) {
102             ((ComponentUI JavaDoc) (uis.elementAt(i))).installUI(a);
103         }
104     }
105
106     /**
107      * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
108      */

109     public void uninstallUI(JComponent JavaDoc a) {
110         for (int i = 0; i < uis.size(); i++) {
111             ((ComponentUI JavaDoc) (uis.elementAt(i))).uninstallUI(a);
112         }
113     }
114
115     /**
116      * Invokes the <code>paint</code> method on each UI handled by this object.
117      */

118     public void paint(Graphics JavaDoc a, JComponent JavaDoc b) {
119         for (int i = 0; i < uis.size(); i++) {
120             ((ComponentUI JavaDoc) (uis.elementAt(i))).paint(a,b);
121         }
122     }
123
124     /**
125      * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
126      *
127      * @return the value obtained from the first UI, which is
128      * the UI obtained from the default <code>LookAndFeel</code>
129      */

130     public Dimension JavaDoc getPreferredSize(JComponent JavaDoc a) {
131         Dimension JavaDoc returnValue =
132             ((ComponentUI JavaDoc) (uis.elementAt(0))).getPreferredSize(a);
133         for (int i = 1; i < uis.size(); i++) {
134             ((ComponentUI JavaDoc) (uis.elementAt(i))).getPreferredSize(a);
135         }
136         return returnValue;
137     }
138
139     /**
140      * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
141      *
142      * @return the value obtained from the first UI, which is
143      * the UI obtained from the default <code>LookAndFeel</code>
144      */

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

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

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

190     public Accessible JavaDoc getAccessibleChild(JComponent JavaDoc a, int b) {
191         Accessible JavaDoc returnValue =
192             ((ComponentUI JavaDoc) (uis.elementAt(0))).getAccessibleChild(a,b);
193         for (int i = 1; i < uis.size(); i++) {
194             ((ComponentUI JavaDoc) (uis.elementAt(i))).getAccessibleChild(a,b);
195         }
196         return returnValue;
197     }
198 }
199
Popular Tags