1 7 package javax.swing.plaf.multi; 8 9 import java.util.Vector ; 10 import javax.swing.plaf.TextUI ; 11 import java.lang.String ; 12 import javax.swing.text.JTextComponent ; 13 import java.awt.Point ; 14 import java.awt.Rectangle ; 15 import javax.swing.text.BadLocationException ; 16 import javax.swing.text.Position ; 17 import javax.swing.text.EditorKit ; 18 import javax.swing.text.View ; 19 import javax.swing.plaf.ComponentUI ; 20 import javax.swing.JComponent ; 21 import java.awt.Graphics ; 22 import java.awt.Dimension ; 23 import javax.accessibility.Accessible ; 24 25 33 public class MultiTextUI extends TextUI { 34 35 41 protected Vector uis = new Vector (); 42 43 47 52 public ComponentUI [] getUIs() { 53 return MultiLookAndFeel.uisToArray(uis); 54 } 55 56 60 66 public String getToolTipText(JTextComponent a, Point b) { 67 String returnValue = 68 ((TextUI ) (uis.elementAt(0))).getToolTipText(a,b); 69 for (int i = 1; i < uis.size(); i++) { 70 ((TextUI ) (uis.elementAt(i))).getToolTipText(a,b); 71 } 72 return returnValue; 73 } 74 75 81 public Rectangle modelToView(JTextComponent a, int b) 82 throws BadLocationException { 83 Rectangle returnValue = 84 ((TextUI ) (uis.elementAt(0))).modelToView(a,b); 85 for (int i = 1; i < uis.size(); i++) { 86 ((TextUI ) (uis.elementAt(i))).modelToView(a,b); 87 } 88 return returnValue; 89 } 90 91 97 public Rectangle modelToView(JTextComponent a, int b, Position.Bias c) 98 throws BadLocationException { 99 Rectangle returnValue = 100 ((TextUI ) (uis.elementAt(0))).modelToView(a,b,c); 101 for (int i = 1; i < uis.size(); i++) { 102 ((TextUI ) (uis.elementAt(i))).modelToView(a,b,c); 103 } 104 return returnValue; 105 } 106 107 113 public int viewToModel(JTextComponent a, Point b) { 114 int returnValue = 115 ((TextUI ) (uis.elementAt(0))).viewToModel(a,b); 116 for (int i = 1; i < uis.size(); i++) { 117 ((TextUI ) (uis.elementAt(i))).viewToModel(a,b); 118 } 119 return returnValue; 120 } 121 122 128 public int viewToModel(JTextComponent a, Point b, Position.Bias [] c) { 129 int returnValue = 130 ((TextUI ) (uis.elementAt(0))).viewToModel(a,b,c); 131 for (int i = 1; i < uis.size(); i++) { 132 ((TextUI ) (uis.elementAt(i))).viewToModel(a,b,c); 133 } 134 return returnValue; 135 } 136 137 143 public int getNextVisualPositionFrom(JTextComponent a, int b, Position.Bias c, int d, Position.Bias [] e) 144 throws BadLocationException { 145 int returnValue = 146 ((TextUI ) (uis.elementAt(0))).getNextVisualPositionFrom(a,b,c,d,e); 147 for (int i = 1; i < uis.size(); i++) { 148 ((TextUI ) (uis.elementAt(i))).getNextVisualPositionFrom(a,b,c,d,e); 149 } 150 return returnValue; 151 } 152 153 156 public void damageRange(JTextComponent a, int b, int c) { 157 for (int i = 0; i < uis.size(); i++) { 158 ((TextUI ) (uis.elementAt(i))).damageRange(a,b,c); 159 } 160 } 161 162 165 public void damageRange(JTextComponent a, int b, int c, Position.Bias d, Position.Bias e) { 166 for (int i = 0; i < uis.size(); i++) { 167 ((TextUI ) (uis.elementAt(i))).damageRange(a,b,c,d,e); 168 } 169 } 170 171 177 public EditorKit getEditorKit(JTextComponent a) { 178 EditorKit returnValue = 179 ((TextUI ) (uis.elementAt(0))).getEditorKit(a); 180 for (int i = 1; i < uis.size(); i++) { 181 ((TextUI ) (uis.elementAt(i))).getEditorKit(a); 182 } 183 return returnValue; 184 } 185 186 192 public View getRootView(JTextComponent a) { 193 View returnValue = 194 ((TextUI ) (uis.elementAt(0))).getRootView(a); 195 for (int i = 1; i < uis.size(); i++) { 196 ((TextUI ) (uis.elementAt(i))).getRootView(a); 197 } 198 return returnValue; 199 } 200 201 205 211 public boolean contains(JComponent a, int b, int c) { 212 boolean returnValue = 213 ((ComponentUI ) (uis.elementAt(0))).contains(a,b,c); 214 for (int i = 1; i < uis.size(); i++) { 215 ((ComponentUI ) (uis.elementAt(i))).contains(a,b,c); 216 } 217 return returnValue; 218 } 219 220 223 public void update(Graphics a, JComponent b) { 224 for (int i = 0; i < uis.size(); i++) { 225 ((ComponentUI ) (uis.elementAt(i))).update(a,b); 226 } 227 } 228 229 234 public static ComponentUI createUI(JComponent a) { 235 ComponentUI mui = new MultiTextUI (); 236 return MultiLookAndFeel.createUIs(mui, 237 ((MultiTextUI ) mui).uis, 238 a); 239 } 240 241 244 public void installUI(JComponent a) { 245 for (int i = 0; i < uis.size(); i++) { 246 ((ComponentUI ) (uis.elementAt(i))).installUI(a); 247 } 248 } 249 250 253 public void uninstallUI(JComponent a) { 254 for (int i = 0; i < uis.size(); i++) { 255 ((ComponentUI ) (uis.elementAt(i))).uninstallUI(a); 256 } 257 } 258 259 262 public void paint(Graphics a, JComponent b) { 263 for (int i = 0; i < uis.size(); i++) { 264 ((ComponentUI ) (uis.elementAt(i))).paint(a,b); 265 } 266 } 267 268 274 public Dimension getPreferredSize(JComponent a) { 275 Dimension returnValue = 276 ((ComponentUI ) (uis.elementAt(0))).getPreferredSize(a); 277 for (int i = 1; i < uis.size(); i++) { 278 ((ComponentUI ) (uis.elementAt(i))).getPreferredSize(a); 279 } 280 return returnValue; 281 } 282 283 289 public Dimension getMinimumSize(JComponent a) { 290 Dimension returnValue = 291 ((ComponentUI ) (uis.elementAt(0))).getMinimumSize(a); 292 for (int i = 1; i < uis.size(); i++) { 293 ((ComponentUI ) (uis.elementAt(i))).getMinimumSize(a); 294 } 295 return returnValue; 296 } 297 298 304 public Dimension getMaximumSize(JComponent a) { 305 Dimension returnValue = 306 ((ComponentUI ) (uis.elementAt(0))).getMaximumSize(a); 307 for (int i = 1; i < uis.size(); i++) { 308 ((ComponentUI ) (uis.elementAt(i))).getMaximumSize(a); 309 } 310 return returnValue; 311 } 312 313 319 public int getAccessibleChildrenCount(JComponent a) { 320 int returnValue = 321 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChildrenCount(a); 322 for (int i = 1; i < uis.size(); i++) { 323 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChildrenCount(a); 324 } 325 return returnValue; 326 } 327 328 334 public Accessible getAccessibleChild(JComponent a, int b) { 335 Accessible returnValue = 336 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChild(a,b); 337 for (int i = 1; i < uis.size(); i++) { 338 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChild(a,b); 339 } 340 return returnValue; 341 } 342 } 343 | Popular Tags |