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