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