1. /*
  2. * @(#)MultiOptionPaneUI.java 1.24 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf.multi;
  8. import java.util.Vector;
  9. import javax.swing.plaf.OptionPaneUI;
  10. import javax.swing.JOptionPane;
  11. import javax.swing.plaf.ComponentUI;
  12. import javax.swing.JComponent;
  13. import java.awt.Graphics;
  14. import java.awt.Dimension;
  15. import javax.accessibility.Accessible;
  16. /**
  17. * A multiplexing UI used to combine <code>OptionPaneUI</code>s.
  18. *
  19. * <p>This file was automatically generated by AutoMulti.
  20. *
  21. * @version 1.24 01/23/03 13:24:18
  22. * @author Otto Multey
  23. */
  24. public class MultiOptionPaneUI extends OptionPaneUI {
  25. /**
  26. * The vector containing the real UIs. This is populated
  27. * in the call to <code>createUI</code>, and can be obtained by calling
  28. * the <code>getUIs</code> method. The first element is guaranteed to be the real UI
  29. * obtained from the default look and feel.
  30. */
  31. protected Vector uis = new Vector();
  32. ////////////////////
  33. // Common UI methods
  34. ////////////////////
  35. /**
  36. * Returns the list of UIs associated with this multiplexing UI. This
  37. * allows processing of the UIs by an application aware of multiplexing
  38. * UIs on components.
  39. */
  40. public ComponentUI[] getUIs() {
  41. return MultiLookAndFeel.uisToArray(uis);
  42. }
  43. ////////////////////
  44. // OptionPaneUI methods
  45. ////////////////////
  46. /**
  47. * Invokes the <code>selectInitialValue</code> method on each UI handled by this object.
  48. */
  49. public void selectInitialValue(JOptionPane a) {
  50. for (int i = 0; i < uis.size(); i++) {
  51. ((OptionPaneUI) (uis.elementAt(i))).selectInitialValue(a);
  52. }
  53. }
  54. /**
  55. * Invokes the <code>containsCustomComponents</code> method on each UI handled by this object.
  56. *
  57. * @return the value obtained from the first UI, which is
  58. * the UI obtained from the default <code>LookAndFeel</code>
  59. */
  60. public boolean containsCustomComponents(JOptionPane a) {
  61. boolean returnValue =
  62. ((OptionPaneUI) (uis.elementAt(0))).containsCustomComponents(a);
  63. for (int i = 1; i < uis.size(); i++) {
  64. ((OptionPaneUI) (uis.elementAt(i))).containsCustomComponents(a);
  65. }
  66. return returnValue;
  67. }
  68. ////////////////////
  69. // ComponentUI methods
  70. ////////////////////
  71. /**
  72. * Invokes the <code>contains</code> method on each UI handled by this object.
  73. *
  74. * @return the value obtained from the first UI, which is
  75. * the UI obtained from the default <code>LookAndFeel</code>
  76. */
  77. public boolean contains(JComponent a, int b, int c) {
  78. boolean returnValue =
  79. ((ComponentUI) (uis.elementAt(0))).contains(a,b,c);
  80. for (int i = 1; i < uis.size(); i++) {
  81. ((ComponentUI) (uis.elementAt(i))).contains(a,b,c);
  82. }
  83. return returnValue;
  84. }
  85. /**
  86. * Invokes the <code>update</code> method on each UI handled by this object.
  87. */
  88. public void update(Graphics a, JComponent b) {
  89. for (int i = 0; i < uis.size(); i++) {
  90. ((ComponentUI) (uis.elementAt(i))).update(a,b);
  91. }
  92. }
  93. /**
  94. * Returns a multiplexing UI instance if any of the auxiliary
  95. * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the
  96. * UI object obtained from the default <code>LookAndFeel</code>.
  97. */
  98. public static ComponentUI createUI(JComponent a) {
  99. ComponentUI mui = new MultiOptionPaneUI();
  100. return MultiLookAndFeel.createUIs(mui,
  101. ((MultiOptionPaneUI) mui).uis,
  102. a);
  103. }
  104. /**
  105. * Invokes the <code>installUI</code> method on each UI handled by this object.
  106. */
  107. public void installUI(JComponent a) {
  108. for (int i = 0; i < uis.size(); i++) {
  109. ((ComponentUI) (uis.elementAt(i))).installUI(a);
  110. }
  111. }
  112. /**
  113. * Invokes the <code>uninstallUI</code> method on each UI handled by this object.
  114. */
  115. public void uninstallUI(JComponent a) {
  116. for (int i = 0; i < uis.size(); i++) {
  117. ((ComponentUI) (uis.elementAt(i))).uninstallUI(a);
  118. }
  119. }
  120. /**
  121. * Invokes the <code>paint</code> method on each UI handled by this object.
  122. */
  123. public void paint(Graphics a, JComponent b) {
  124. for (int i = 0; i < uis.size(); i++) {
  125. ((ComponentUI) (uis.elementAt(i))).paint(a,b);
  126. }
  127. }
  128. /**
  129. * Invokes the <code>getPreferredSize</code> method on each UI handled by this object.
  130. *
  131. * @return the value obtained from the first UI, which is
  132. * the UI obtained from the default <code>LookAndFeel</code>
  133. */
  134. public Dimension getPreferredSize(JComponent a) {
  135. Dimension returnValue =
  136. ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a);
  137. for (int i = 1; i < uis.size(); i++) {
  138. ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a);
  139. }
  140. return returnValue;
  141. }
  142. /**
  143. * Invokes the <code>getMinimumSize</code> method on each UI handled by this object.
  144. *
  145. * @return the value obtained from the first UI, which is
  146. * the UI obtained from the default <code>LookAndFeel</code>
  147. */
  148. public Dimension getMinimumSize(JComponent a) {
  149. Dimension returnValue =
  150. ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a);
  151. for (int i = 1; i < uis.size(); i++) {
  152. ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a);
  153. }
  154. return returnValue;
  155. }
  156. /**
  157. * Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
  158. *
  159. * @return the value obtained from the first UI, which is
  160. * the UI obtained from the default <code>LookAndFeel</code>
  161. */
  162. public Dimension getMaximumSize(JComponent a) {
  163. Dimension returnValue =
  164. ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
  165. for (int i = 1; i < uis.size(); i++) {
  166. ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
  167. }
  168. return returnValue;
  169. }
  170. /**
  171. * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object.
  172. *
  173. * @return the value obtained from the first UI, which is
  174. * the UI obtained from the default <code>LookAndFeel</code>
  175. */
  176. public int getAccessibleChildrenCount(JComponent a) {
  177. int returnValue =
  178. ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a);
  179. for (int i = 1; i < uis.size(); i++) {
  180. ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a);
  181. }
  182. return returnValue;
  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 getAccessibleChild(JComponent a, int b) {
  191. Accessible returnValue =
  192. ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b);
  193. for (int i = 1; i < uis.size(); i++) {
  194. ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b);
  195. }
  196. return returnValue;
  197. }
  198. }