1 7 package javax.swing.plaf.multi; 8 9 import java.util.Vector ; 10 import javax.swing.plaf.ListUI ; 11 import javax.swing.JList ; 12 import java.awt.Point ; 13 import java.awt.Rectangle ; 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 28 public class MultiListUI extends ListUI { 29 30 36 protected Vector uis = new Vector (); 37 38 42 47 public ComponentUI [] getUIs() { 48 return MultiLookAndFeel.uisToArray(uis); 49 } 50 51 55 61 public int locationToIndex(JList a, Point b) { 62 int returnValue = 63 ((ListUI ) (uis.elementAt(0))).locationToIndex(a,b); 64 for (int i = 1; i < uis.size(); i++) { 65 ((ListUI ) (uis.elementAt(i))).locationToIndex(a,b); 66 } 67 return returnValue; 68 } 69 70 76 public Point indexToLocation(JList a, int b) { 77 Point returnValue = 78 ((ListUI ) (uis.elementAt(0))).indexToLocation(a,b); 79 for (int i = 1; i < uis.size(); i++) { 80 ((ListUI ) (uis.elementAt(i))).indexToLocation(a,b); 81 } 82 return returnValue; 83 } 84 85 91 public Rectangle getCellBounds(JList a, int b, int c) { 92 Rectangle returnValue = 93 ((ListUI ) (uis.elementAt(0))).getCellBounds(a,b,c); 94 for (int i = 1; i < uis.size(); i++) { 95 ((ListUI ) (uis.elementAt(i))).getCellBounds(a,b,c); 96 } 97 return returnValue; 98 } 99 100 104 110 public boolean contains(JComponent a, int b, int c) { 111 boolean returnValue = 112 ((ComponentUI ) (uis.elementAt(0))).contains(a,b,c); 113 for (int i = 1; i < uis.size(); i++) { 114 ((ComponentUI ) (uis.elementAt(i))).contains(a,b,c); 115 } 116 return returnValue; 117 } 118 119 122 public void update(Graphics a, JComponent b) { 123 for (int i = 0; i < uis.size(); i++) { 124 ((ComponentUI ) (uis.elementAt(i))).update(a,b); 125 } 126 } 127 128 133 public static ComponentUI createUI(JComponent a) { 134 ComponentUI mui = new MultiListUI (); 135 return MultiLookAndFeel.createUIs(mui, 136 ((MultiListUI ) mui).uis, 137 a); 138 } 139 140 143 public void installUI(JComponent a) { 144 for (int i = 0; i < uis.size(); i++) { 145 ((ComponentUI ) (uis.elementAt(i))).installUI(a); 146 } 147 } 148 149 152 public void uninstallUI(JComponent a) { 153 for (int i = 0; i < uis.size(); i++) { 154 ((ComponentUI ) (uis.elementAt(i))).uninstallUI(a); 155 } 156 } 157 158 161 public void paint(Graphics a, JComponent b) { 162 for (int i = 0; i < uis.size(); i++) { 163 ((ComponentUI ) (uis.elementAt(i))).paint(a,b); 164 } 165 } 166 167 173 public Dimension getPreferredSize(JComponent a) { 174 Dimension returnValue = 175 ((ComponentUI ) (uis.elementAt(0))).getPreferredSize(a); 176 for (int i = 1; i < uis.size(); i++) { 177 ((ComponentUI ) (uis.elementAt(i))).getPreferredSize(a); 178 } 179 return returnValue; 180 } 181 182 188 public Dimension getMinimumSize(JComponent a) { 189 Dimension returnValue = 190 ((ComponentUI ) (uis.elementAt(0))).getMinimumSize(a); 191 for (int i = 1; i < uis.size(); i++) { 192 ((ComponentUI ) (uis.elementAt(i))).getMinimumSize(a); 193 } 194 return returnValue; 195 } 196 197 203 public Dimension getMaximumSize(JComponent a) { 204 Dimension returnValue = 205 ((ComponentUI ) (uis.elementAt(0))).getMaximumSize(a); 206 for (int i = 1; i < uis.size(); i++) { 207 ((ComponentUI ) (uis.elementAt(i))).getMaximumSize(a); 208 } 209 return returnValue; 210 } 211 212 218 public int getAccessibleChildrenCount(JComponent a) { 219 int returnValue = 220 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChildrenCount(a); 221 for (int i = 1; i < uis.size(); i++) { 222 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChildrenCount(a); 223 } 224 return returnValue; 225 } 226 227 233 public Accessible getAccessibleChild(JComponent a, int b) { 234 Accessible returnValue = 235 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChild(a,b); 236 for (int i = 1; i < uis.size(); i++) { 237 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChild(a,b); 238 } 239 return returnValue; 240 } 241 } 242 | Popular Tags |