1 /* 2 * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 package javax.swing.plaf.multi; 26 27 import java.util.Vector; 28 import javax.swing.plaf.TabbedPaneUI; 29 import javax.swing.JTabbedPane; 30 import java.awt.Rectangle; 31 import javax.swing.plaf.ComponentUI; 32 import javax.swing.JComponent; 33 import java.awt.Graphics; 34 import java.awt.Dimension; 35 import javax.accessibility.Accessible; 36 37 /** 38 * A multiplexing UI used to combine <code>TabbedPaneUI</code>s. 39 * 40 * <p>This file was automatically generated by AutoMulti. 41 * 42 * @author Otto Multey 43 */ 44 public class MultiTabbedPaneUI extends TabbedPaneUI { 45 46 /** 47 * The vector containing the real UIs. This is populated 48 * in the call to <code>createUI</code>, and can be obtained by calling 49 * the <code>getUIs</code> method. The first element is guaranteed to be the real UI 50 * obtained from the default look and feel. 51 */ 52 protected Vector uis = new Vector(); 53 54 //////////////////// 55 // Common UI methods 56 //////////////////// 57 58 /** 59 * Returns the list of UIs associated with this multiplexing UI. This 60 * allows processing of the UIs by an application aware of multiplexing 61 * UIs on components. 62 */ 63 public ComponentUI[] getUIs() { 64 return MultiLookAndFeel.uisToArray(uis); 65 } 66 67 //////////////////// 68 // TabbedPaneUI methods 69 //////////////////// 70 71 /** 72 * Invokes the <code>tabForCoordinate</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 int tabForCoordinate(JTabbedPane a, int b, int c) { 78 int returnValue = 79 ((TabbedPaneUI) (uis.elementAt(0))).tabForCoordinate(a,b,c); 80 for (int i = 1; i < uis.size(); i++) { 81 ((TabbedPaneUI) (uis.elementAt(i))).tabForCoordinate(a,b,c); 82 } 83 return returnValue; 84 } 85 86 /** 87 * Invokes the <code>getTabBounds</code> method on each UI handled by this object. 88 * 89 * @return the value obtained from the first UI, which is 90 * the UI obtained from the default <code>LookAndFeel</code> 91 */ 92 public Rectangle getTabBounds(JTabbedPane a, int b) { 93 Rectangle returnValue = 94 ((TabbedPaneUI) (uis.elementAt(0))).getTabBounds(a,b); 95 for (int i = 1; i < uis.size(); i++) { 96 ((TabbedPaneUI) (uis.elementAt(i))).getTabBounds(a,b); 97 } 98 return returnValue; 99 } 100 101 /** 102 * Invokes the <code>getTabRunCount</code> method on each UI handled by this object. 103 * 104 * @return the value obtained from the first UI, which is 105 * the UI obtained from the default <code>LookAndFeel</code> 106 */ 107 public int getTabRunCount(JTabbedPane a) { 108 int returnValue = 109 ((TabbedPaneUI) (uis.elementAt(0))).getTabRunCount(a); 110 for (int i = 1; i < uis.size(); i++) { 111 ((TabbedPaneUI) (uis.elementAt(i))).getTabRunCount(a); 112 } 113 return returnValue; 114 } 115 116 //////////////////// 117 // ComponentUI methods 118 //////////////////// 119 120 /** 121 * Invokes the <code>contains</code> method on each UI handled by this object. 122 * 123 * @return the value obtained from the first UI, which is 124 * the UI obtained from the default <code>LookAndFeel</code> 125 */ 126 public boolean contains(JComponent a, int b, int c) { 127 boolean returnValue = 128 ((ComponentUI) (uis.elementAt(0))).contains(a,b,c); 129 for (int i = 1; i < uis.size(); i++) { 130 ((ComponentUI) (uis.elementAt(i))).contains(a,b,c); 131 } 132 return returnValue; 133 } 134 135 /** 136 * Invokes the <code>update</code> method on each UI handled by this object. 137 */ 138 public void update(Graphics a, JComponent b) { 139 for (int i = 0; i < uis.size(); i++) { 140 ((ComponentUI) (uis.elementAt(i))).update(a,b); 141 } 142 } 143 144 /** 145 * Returns a multiplexing UI instance if any of the auxiliary 146 * <code>LookAndFeel</code>s supports this UI. Otherwise, just returns the 147 * UI object obtained from the default <code>LookAndFeel</code>. 148 */ 149 public static ComponentUI createUI(JComponent a) { 150 ComponentUI mui = new MultiTabbedPaneUI(); 151 return MultiLookAndFeel.createUIs(mui, 152 ((MultiTabbedPaneUI) mui).uis, 153 a); 154 } 155 156 /** 157 * Invokes the <code>installUI</code> method on each UI handled by this object. 158 */ 159 public void installUI(JComponent a) { 160 for (int i = 0; i < uis.size(); i++) { 161 ((ComponentUI) (uis.elementAt(i))).installUI(a); 162 } 163 } 164 165 /** 166 * Invokes the <code>uninstallUI</code> method on each UI handled by this object. 167 */ 168 public void uninstallUI(JComponent a) { 169 for (int i = 0; i < uis.size(); i++) { 170 ((ComponentUI) (uis.elementAt(i))).uninstallUI(a); 171 } 172 } 173 174 /** 175 * Invokes the <code>paint</code> method on each UI handled by this object. 176 */ 177 public void paint(Graphics a, JComponent b) { 178 for (int i = 0; i < uis.size(); i++) { 179 ((ComponentUI) (uis.elementAt(i))).paint(a,b); 180 } 181 } 182 183 /** 184 * Invokes the <code>getPreferredSize</code> method on each UI handled by this object. 185 * 186 * @return the value obtained from the first UI, which is 187 * the UI obtained from the default <code>LookAndFeel</code> 188 */ 189 public Dimension getPreferredSize(JComponent a) { 190 Dimension returnValue = 191 ((ComponentUI) (uis.elementAt(0))).getPreferredSize(a); 192 for (int i = 1; i < uis.size(); i++) { 193 ((ComponentUI) (uis.elementAt(i))).getPreferredSize(a); 194 } 195 return returnValue; 196 } 197 198 /** 199 * Invokes the <code>getMinimumSize</code> method on each UI handled by this object. 200 * 201 * @return the value obtained from the first UI, which is 202 * the UI obtained from the default <code>LookAndFeel</code> 203 */ 204 public Dimension getMinimumSize(JComponent a) { 205 Dimension returnValue = 206 ((ComponentUI) (uis.elementAt(0))).getMinimumSize(a); 207 for (int i = 1; i < uis.size(); i++) { 208 ((ComponentUI) (uis.elementAt(i))).getMinimumSize(a); 209 } 210 return returnValue; 211 } 212 213 /** 214 * Invokes the <code>getMaximumSize</code> method on each UI handled by this object. 215 * 216 * @return the value obtained from the first UI, which is 217 * the UI obtained from the default <code>LookAndFeel</code> 218 */ 219 public Dimension getMaximumSize(JComponent a) { 220 Dimension returnValue = 221 ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a); 222 for (int i = 1; i < uis.size(); i++) { 223 ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a); 224 } 225 return returnValue; 226 } 227 228 /** 229 * Invokes the <code>getAccessibleChildrenCount</code> method on each UI handled by this object. 230 * 231 * @return the value obtained from the first UI, which is 232 * the UI obtained from the default <code>LookAndFeel</code> 233 */ 234 public int getAccessibleChildrenCount(JComponent a) { 235 int returnValue = 236 ((ComponentUI) (uis.elementAt(0))).getAccessibleChildrenCount(a); 237 for (int i = 1; i < uis.size(); i++) { 238 ((ComponentUI) (uis.elementAt(i))).getAccessibleChildrenCount(a); 239 } 240 return returnValue; 241 } 242 243 /** 244 * Invokes the <code>getAccessibleChild</code> method on each UI handled by this object. 245 * 246 * @return the value obtained from the first UI, which is 247 * the UI obtained from the default <code>LookAndFeel</code> 248 */ 249 public Accessible getAccessibleChild(JComponent a, int b) { 250 Accessible returnValue = 251 ((ComponentUI) (uis.elementAt(0))).getAccessibleChild(a,b); 252 for (int i = 1; i < uis.size(); i++) { 253 ((ComponentUI) (uis.elementAt(i))).getAccessibleChild(a,b); 254 } 255 return returnValue; 256 } 257 }