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