1 7 package javax.swing.plaf.multi; 8 9 import java.util.Vector ; 10 import javax.swing.plaf.PopupMenuUI ; 11 import java.awt.event.MouseEvent ; 12 import javax.swing.Popup ; 13 import javax.swing.JPopupMenu ; 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 MultiPopupMenuUI extends PopupMenuUI { 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 boolean isPopupTrigger(MouseEvent a) { 62 boolean returnValue = 63 ((PopupMenuUI ) (uis.elementAt(0))).isPopupTrigger(a); 64 for (int i = 1; i < uis.size(); i++) { 65 ((PopupMenuUI ) (uis.elementAt(i))).isPopupTrigger(a); 66 } 67 return returnValue; 68 } 69 70 76 public Popup getPopup(JPopupMenu a, int b, int c) { 77 Popup returnValue = 78 ((PopupMenuUI ) (uis.elementAt(0))).getPopup(a,b,c); 79 for (int i = 1; i < uis.size(); i++) { 80 ((PopupMenuUI ) (uis.elementAt(i))).getPopup(a,b,c); 81 } 82 return returnValue; 83 } 84 85 89 95 public boolean contains(JComponent a, int b, int c) { 96 boolean returnValue = 97 ((ComponentUI ) (uis.elementAt(0))).contains(a,b,c); 98 for (int i = 1; i < uis.size(); i++) { 99 ((ComponentUI ) (uis.elementAt(i))).contains(a,b,c); 100 } 101 return returnValue; 102 } 103 104 107 public void update(Graphics a, JComponent b) { 108 for (int i = 0; i < uis.size(); i++) { 109 ((ComponentUI ) (uis.elementAt(i))).update(a,b); 110 } 111 } 112 113 118 public static ComponentUI createUI(JComponent a) { 119 ComponentUI mui = new MultiPopupMenuUI (); 120 return MultiLookAndFeel.createUIs(mui, 121 ((MultiPopupMenuUI ) mui).uis, 122 a); 123 } 124 125 128 public void installUI(JComponent a) { 129 for (int i = 0; i < uis.size(); i++) { 130 ((ComponentUI ) (uis.elementAt(i))).installUI(a); 131 } 132 } 133 134 137 public void uninstallUI(JComponent a) { 138 for (int i = 0; i < uis.size(); i++) { 139 ((ComponentUI ) (uis.elementAt(i))).uninstallUI(a); 140 } 141 } 142 143 146 public void paint(Graphics a, JComponent b) { 147 for (int i = 0; i < uis.size(); i++) { 148 ((ComponentUI ) (uis.elementAt(i))).paint(a,b); 149 } 150 } 151 152 158 public Dimension getPreferredSize(JComponent a) { 159 Dimension returnValue = 160 ((ComponentUI ) (uis.elementAt(0))).getPreferredSize(a); 161 for (int i = 1; i < uis.size(); i++) { 162 ((ComponentUI ) (uis.elementAt(i))).getPreferredSize(a); 163 } 164 return returnValue; 165 } 166 167 173 public Dimension getMinimumSize(JComponent a) { 174 Dimension returnValue = 175 ((ComponentUI ) (uis.elementAt(0))).getMinimumSize(a); 176 for (int i = 1; i < uis.size(); i++) { 177 ((ComponentUI ) (uis.elementAt(i))).getMinimumSize(a); 178 } 179 return returnValue; 180 } 181 182 188 public Dimension getMaximumSize(JComponent a) { 189 Dimension returnValue = 190 ((ComponentUI ) (uis.elementAt(0))).getMaximumSize(a); 191 for (int i = 1; i < uis.size(); i++) { 192 ((ComponentUI ) (uis.elementAt(i))).getMaximumSize(a); 193 } 194 return returnValue; 195 } 196 197 203 public int getAccessibleChildrenCount(JComponent a) { 204 int returnValue = 205 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChildrenCount(a); 206 for (int i = 1; i < uis.size(); i++) { 207 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChildrenCount(a); 208 } 209 return returnValue; 210 } 211 212 218 public Accessible getAccessibleChild(JComponent a, int b) { 219 Accessible returnValue = 220 ((ComponentUI ) (uis.elementAt(0))).getAccessibleChild(a,b); 221 for (int i = 1; i < uis.size(); i++) { 222 ((ComponentUI ) (uis.elementAt(i))).getAccessibleChild(a,b); 223 } 224 return returnValue; 225 } 226 } 227 | Popular Tags |