| 1 | /* Copyright (C) 1999, 2000, 2002 Free Software Foundation
|
|---|
| 2 |
|
|---|
| 3 | This file is part of GNU Classpath.
|
|---|
| 4 |
|
|---|
| 5 | GNU Classpath is free software; you can redistribute it and/or modify
|
|---|
| 6 | it under the terms of the GNU General Public License as published by
|
|---|
| 7 | the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 8 | any later version.
|
|---|
| 9 |
|
|---|
| 10 | GNU Classpath is distributed in the hope that it will be useful, but
|
|---|
| 11 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 13 | General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU General Public License
|
|---|
| 16 | along with GNU Classpath; see the file COPYING. If not, write to the
|
|---|
| 17 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|---|
| 18 | 02111-1307 USA.
|
|---|
| 19 |
|
|---|
| 20 | Linking this library statically or dynamically with other modules is
|
|---|
| 21 | making a combined work based on this library. Thus, the terms and
|
|---|
| 22 | conditions of the GNU General Public License cover the whole
|
|---|
| 23 | combination.
|
|---|
| 24 |
|
|---|
| 25 | As a special exception, the copyright holders of this library give you
|
|---|
| 26 | permission to link this library with independent modules to produce an
|
|---|
| 27 | executable, regardless of the license terms of these independent
|
|---|
| 28 | modules, and to copy and distribute the resulting executable under
|
|---|
| 29 | terms of your choice, provided that you also meet, for each linked
|
|---|
| 30 | independent module, the terms and conditions of the license of that
|
|---|
| 31 | module. An independent module is a module which is not derived from
|
|---|
| 32 | or based on this library. If you modify this library, you may extend
|
|---|
| 33 | this exception to your version of the library, but you are not
|
|---|
| 34 | obligated to do so. If you do not wish to do so, delete this
|
|---|
| 35 | exception statement from your version. */
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 | package java.awt;
|
|---|
| 39 |
|
|---|
| 40 | import java.awt.event.*;
|
|---|
| 41 | import java.util.EventListener;
|
|---|
| 42 | import java.io.ObjectOutputStream;
|
|---|
| 43 |
|
|---|
| 44 | /* Written using on-line Java 2 Platform Standard Edition v1.3 API
|
|---|
| 45 | * Specification, as well as "The Java Class Libraries", 2nd edition
|
|---|
| 46 | * (Addison-Wesley, 1998).
|
|---|
| 47 | * Status: Believed complete and correct to J2SE 1.3, except for
|
|---|
| 48 | * serialization support methods, save() and saveInternal(), which are
|
|---|
| 49 | * stubbed.
|
|---|
| 50 | */
|
|---|
| 51 |
|
|---|
| 52 | /**
|
|---|
| 53 | * This class is used to implement a chain of event handlers. Dispatching
|
|---|
| 54 | * using this class is thread safe. Here is a quick example of how to
|
|---|
| 55 | * add and delete listeners using this class. For this example, we will
|
|---|
| 56 | * assume are firing <code>AdjustableEvent</code>'s. However, this
|
|---|
| 57 | * same approach is useful for all events in the <code>java.awt.event</code>
|
|---|
| 58 | * package, and more if this class is subclassed.
|
|---|
| 59 | * <p>
|
|---|
| 60 | * <code>
|
|---|
| 61 | * AdjustmentListener al;
|
|---|
| 62 | *
|
|---|
| 63 | * public void
|
|---|
| 64 | * addAdjustmentListener(AdjustmentListener listener)
|
|---|
| 65 | * {
|
|---|
| 66 | * al = AWTEventMulticaster.add(al, listener);
|
|---|
| 67 | * }
|
|---|
| 68 | *
|
|---|
| 69 | * public void
|
|---|
| 70 | * removeAdjustmentListener(AdjustmentListener listener)
|
|---|
| 71 | * {
|
|---|
| 72 | * al = AWTEventMulticaster.remove(al, listener);
|
|---|
| 73 | * }
|
|---|
| 74 | * </code>
|
|---|
| 75 | * <p>
|
|---|
| 76 | * When it come time to process an event, simply call <code>al</code>,
|
|---|
| 77 | * assuming it is not <code>null</code>.
|
|---|
| 78 | * <p>
|
|---|
| 79 | * The first time <code>add</code> is called it is passed
|
|---|
| 80 | * <code>null</code> and <code>listener</code> as its arguments. This
|
|---|
| 81 | * starts building the chain. This class returns <code>listener</code>
|
|---|
| 82 | * which becomes the new <code>al</code>. The next time, <code>add</code>
|
|---|
| 83 | * is called with <code>al</code> and <code>listener</code> and the
|
|---|
| 84 | * new listener is then chained to the old.
|
|---|
| 85 | *
|
|---|
| 86 | * @author Bryce McKinlay
|
|---|
| 87 | * @author Aaron M. Renn ([email protected])
|
|---|
| 88 | */
|
|---|
| 89 | public class AWTEventMulticaster implements ComponentListener,
|
|---|
| 90 | ContainerListener, FocusListener, KeyListener, MouseListener,
|
|---|
| 91 | MouseMotionListener, WindowListener, ActionListener, ItemListener,
|
|---|
| 92 | AdjustmentListener, TextListener, InputMethodListener, HierarchyListener,
|
|---|
| 93 | HierarchyBoundsListener
|
|---|
| 94 | {
|
|---|
| 95 | /**
|
|---|
| 96 | * A variable in the event chain.
|
|---|
| 97 | */
|
|---|
| 98 | protected final EventListener a;
|
|---|
| 99 |
|
|---|
| 100 | /**
|
|---|
| 101 | * A variable in the event chain
|
|---|
| 102 | */
|
|---|
| 103 | protected final EventListener b;
|
|---|
| 104 |
|
|---|
| 105 | /**
|
|---|
| 106 | * Initializes a new instance of <code>AWTEventMulticaster</code> with
|
|---|
| 107 | * the specified event listener parameters.
|
|---|
| 108 | *
|
|---|
| 109 | * @param a The "a" listener object.
|
|---|
| 110 | * @param b The "b" listener object.
|
|---|
| 111 | */
|
|---|
| 112 | protected AWTEventMulticaster(EventListener a,
|
|---|
| 113 | EventListener b)
|
|---|
| 114 | {
|
|---|
| 115 | this.a = a;
|
|---|
| 116 | this.b = b;
|
|---|
| 117 | }
|
|---|
| 118 |
|
|---|
| 119 | /**
|
|---|
| 120 | * Chain <code>EventListener</code> b to a.
|
|---|
| 121 | *
|
|---|
| 122 | * @param a - Listener to chain to.
|
|---|
| 123 | * @param b - Listener to chain.
|
|---|
| 124 | *
|
|---|
| 125 | * @return Latest entry in the chain.
|
|---|
| 126 | */
|
|---|
| 127 | protected static EventListener addInternal(EventListener a, EventListener b)
|
|---|
| 128 | {
|
|---|
| 129 | if (a == null)
|
|---|
| 130 | return b;
|
|---|
| 131 | else if (b == null)
|
|---|
| 132 | return a;
|
|---|
| 133 | else return new AWTEventMulticaster(a, b);
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | /**
|
|---|
| 137 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 138 | *
|
|---|
| 139 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 140 | * @param old The listener to remove.
|
|---|
| 141 | *
|
|---|
| 142 | * @return The resulting listener after the remove operation.
|
|---|
| 143 | */
|
|---|
| 144 | protected static EventListener removeInternal(EventListener l,
|
|---|
| 145 | EventListener oldl)
|
|---|
| 146 | {
|
|---|
| 147 | if (l == oldl)
|
|---|
| 148 | return null;
|
|---|
| 149 | else if (l instanceof AWTEventMulticaster)
|
|---|
| 150 | {
|
|---|
| 151 | AWTEventMulticaster mc = (AWTEventMulticaster) l;
|
|---|
| 152 | return mc.remove(oldl);
|
|---|
| 153 | }
|
|---|
| 154 | return l;
|
|---|
| 155 | }
|
|---|
| 156 |
|
|---|
| 157 | /**
|
|---|
| 158 | * Removes the specified object from this multicaster object. If the
|
|---|
| 159 | * object to remove is not part of this multicaster, then the remove
|
|---|
| 160 | * method on the parent multicaster (if it exists) is called and a
|
|---|
| 161 | * new multicaster object is returned based on that object and this
|
|---|
| 162 | * multicaster's non-parent object.
|
|---|
| 163 | *
|
|---|
| 164 | * @param old The object to remove from this multicaster.
|
|---|
| 165 | *
|
|---|
| 166 | * @return The resulting multicaster with the specified listener removed.
|
|---|
| 167 | */
|
|---|
| 168 | protected EventListener remove(EventListener oldl)
|
|---|
| 169 | {
|
|---|
| 170 | // If oldl is an immediate child, return the other child.
|
|---|
| 171 | if (a == oldl)
|
|---|
| 172 | return b;
|
|---|
| 173 | if (b == oldl)
|
|---|
| 174 | return a;
|
|---|
| 175 |
|
|---|
| 176 | // If a and/or b are Multicaster's, search them recursively.
|
|---|
| 177 | if (a instanceof AWTEventMulticaster)
|
|---|
| 178 | {
|
|---|
| 179 | AWTEventMulticaster mc = (AWTEventMulticaster) a;
|
|---|
| 180 | EventListener newa = mc.remove(oldl);
|
|---|
| 181 | if (newa != a)
|
|---|
| 182 | return new AWTEventMulticaster (newa, b);
|
|---|
| 183 | }
|
|---|
| 184 | if (b instanceof AWTEventMulticaster)
|
|---|
| 185 | {
|
|---|
| 186 | AWTEventMulticaster mc = (AWTEventMulticaster) a;
|
|---|
| 187 | EventListener newb = mc.remove(oldl);
|
|---|
| 188 | if (newb != b)
|
|---|
| 189 | return new AWTEventMulticaster (a, newb);
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | // oldl was not found.
|
|---|
| 193 | return this;
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | /**
|
|---|
| 197 | * Chain <code>ActionListener</code> b to a.
|
|---|
| 198 | *
|
|---|
| 199 | * @param a - Listener to chain to.
|
|---|
| 200 | * @param b - Listener to chain.
|
|---|
| 201 | *
|
|---|
| 202 | * @return Latest entry in the chain.
|
|---|
| 203 | */
|
|---|
| 204 | public static ActionListener add(ActionListener a, ActionListener b)
|
|---|
| 205 | {
|
|---|
| 206 | return (ActionListener) addInternal(a, b);
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | /**
|
|---|
| 210 | * Chain <code>AdjustmentListener</code> b to a.
|
|---|
| 211 | *
|
|---|
| 212 | * @param a - Listener to chain to.
|
|---|
| 213 | * @param b - Listener to chain.
|
|---|
| 214 | *
|
|---|
| 215 | * @return Latest entry in the chain.
|
|---|
| 216 | */
|
|---|
| 217 | public static AdjustmentListener add(AdjustmentListener a,
|
|---|
| 218 | AdjustmentListener b)
|
|---|
| 219 | {
|
|---|
| 220 | return (AdjustmentListener) addInternal(a, b);
|
|---|
| 221 | }
|
|---|
| 222 |
|
|---|
| 223 | /**
|
|---|
| 224 | * Chain <code>ComponentListener</code> b to a.
|
|---|
| 225 | *
|
|---|
| 226 | * @param a - Listener to chain to.
|
|---|
| 227 | * @param b - Listener to chain.
|
|---|
| 228 | *
|
|---|
| 229 | * @return Latest entry in the chain.
|
|---|
| 230 | */
|
|---|
| 231 | public static ComponentListener add(ComponentListener a, ComponentListener b)
|
|---|
| 232 | {
|
|---|
| 233 | return (ComponentListener) addInternal(a, b);
|
|---|
| 234 | }
|
|---|
| 235 |
|
|---|
| 236 | /**
|
|---|
| 237 | * Chain <code>ContainerListener</code> b to a.
|
|---|
| 238 | *
|
|---|
| 239 | * @param a - Listener to chain to.
|
|---|
| 240 | * @param b - Listener to chain.
|
|---|
| 241 | *
|
|---|
| 242 | * @return Latest entry in the chain.
|
|---|
| 243 | */
|
|---|
| 244 | public static ContainerListener add(ContainerListener a, ContainerListener b)
|
|---|
| 245 | {
|
|---|
| 246 | return (ContainerListener) addInternal(a, b);
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | /**
|
|---|
| 250 | * Chain <code>FocusListener</code> b to a.
|
|---|
| 251 | *
|
|---|
| 252 | * @param a - Listener to chain to.
|
|---|
| 253 | * @param b - Listener to chain.
|
|---|
| 254 | *
|
|---|
| 255 | * @return Latest entry in the chain.
|
|---|
| 256 | */
|
|---|
| 257 | public static FocusListener add(FocusListener a, FocusListener b)
|
|---|
| 258 | {
|
|---|
| 259 | return (FocusListener) addInternal(a, b);
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | public static HierarchyBoundsListener add(HierarchyBoundsListener a,
|
|---|
| 263 | HierarchyBoundsListener b)
|
|---|
| 264 | {
|
|---|
| 265 | return (HierarchyBoundsListener) addInternal(a, b);
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 | public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
|
|---|
| 269 | {
|
|---|
| 270 | return (HierarchyListener) addInternal(a, b);
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | public static InputMethodListener add(InputMethodListener a,
|
|---|
| 274 | InputMethodListener b)
|
|---|
| 275 | {
|
|---|
| 276 | return (InputMethodListener) addInternal(a, b);
|
|---|
| 277 | }
|
|---|
| 278 |
|
|---|
| 279 | /**
|
|---|
| 280 | * Chain <code>ItemListener</code> b to a.
|
|---|
| 281 | *
|
|---|
| 282 | * @param a - Listener to chain to.
|
|---|
| 283 | * @param b - Listener to chain.
|
|---|
| 284 | *
|
|---|
| 285 | * @return Latest entry in the chain.
|
|---|
| 286 | */
|
|---|
| 287 | public static ItemListener add(ItemListener a, ItemListener b)
|
|---|
| 288 | {
|
|---|
| 289 | return (ItemListener) addInternal(a, b);
|
|---|
| 290 | }
|
|---|
| 291 |
|
|---|
| 292 | /**
|
|---|
| 293 | * Chain <code>KeyListener</code> b to a.
|
|---|
| 294 | *
|
|---|
| 295 | * @param a - Listener to chain to.
|
|---|
| 296 | * @param b - Listener to chain.
|
|---|
| 297 | *
|
|---|
| 298 | * @return Latest entry in the chain.
|
|---|
| 299 | */
|
|---|
| 300 | public static KeyListener add(KeyListener a, KeyListener b)
|
|---|
| 301 | {
|
|---|
| 302 | return (KeyListener) addInternal(a, b);
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 | /**
|
|---|
| 306 | * Chain <code>MouseListener</code> b to a.
|
|---|
| 307 | *
|
|---|
| 308 | * @param a - Listener to chain to.
|
|---|
| 309 | * @param b - Listener to chain.
|
|---|
| 310 | *
|
|---|
| 311 | * @return Latest entry in the chain.
|
|---|
| 312 | */
|
|---|
| 313 | public static MouseListener add(MouseListener a, MouseListener b)
|
|---|
| 314 | {
|
|---|
| 315 | return (MouseListener) addInternal(a, b);
|
|---|
| 316 | }
|
|---|
| 317 |
|
|---|
| 318 | /**
|
|---|
| 319 | * Chain <code>MouseMotionListener</code> b to a.
|
|---|
| 320 | *
|
|---|
| 321 | * @param a - Listener to chain to.
|
|---|
| 322 | * @param b - Listener to chain.
|
|---|
| 323 | *
|
|---|
| 324 | * @return Latest entry in the chain.
|
|---|
| 325 | */
|
|---|
| 326 | public static MouseMotionListener add(MouseMotionListener a,
|
|---|
| 327 | MouseMotionListener b)
|
|---|
| 328 | {
|
|---|
| 329 | return (MouseMotionListener) addInternal(a, b);
|
|---|
| 330 | }
|
|---|
| 331 |
|
|---|
| 332 | /**
|
|---|
| 333 | * Chain <code>AdjustmentListener</code> b to a.
|
|---|
| 334 | *
|
|---|
| 335 | * @param a - Listener to chain to.
|
|---|
| 336 | * @param b - Listener to chain.
|
|---|
| 337 | *
|
|---|
| 338 | * @return Latest entry in the chain.
|
|---|
| 339 | */
|
|---|
| 340 | public static TextListener add(TextListener a, TextListener b)
|
|---|
| 341 | {
|
|---|
| 342 | return (TextListener) addInternal(a, b);
|
|---|
| 343 | }
|
|---|
| 344 |
|
|---|
| 345 | /**
|
|---|
| 346 | * Chain <code>WindowListener</code> b to a.
|
|---|
| 347 | *
|
|---|
| 348 | * @param a - Listener to chain to.
|
|---|
| 349 | * @param b - Listener to chain.
|
|---|
| 350 | *
|
|---|
| 351 | * @return Latest entry in the chain.
|
|---|
| 352 | */
|
|---|
| 353 | public static WindowListener add(WindowListener a, WindowListener b)
|
|---|
| 354 | {
|
|---|
| 355 | return (WindowListener) addInternal(a, b);
|
|---|
| 356 | }
|
|---|
| 357 |
|
|---|
| 358 | /**
|
|---|
| 359 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 360 | *
|
|---|
| 361 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 362 | * @param old The listener to remove.
|
|---|
| 363 | *
|
|---|
| 364 | * @return The resulting listener after the remove operation.
|
|---|
| 365 | */
|
|---|
| 366 | public static ActionListener remove(ActionListener l, ActionListener oldl)
|
|---|
| 367 | {
|
|---|
| 368 | return (ActionListener) removeInternal(l, oldl);
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | /**
|
|---|
| 372 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 373 | *
|
|---|
| 374 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 375 | * @param old The listener to remove.
|
|---|
| 376 | *
|
|---|
| 377 | * @return The resulting listener after the remove operation.
|
|---|
| 378 | */
|
|---|
| 379 | public static AdjustmentListener remove(AdjustmentListener l,
|
|---|
| 380 | AdjustmentListener oldl)
|
|---|
| 381 | {
|
|---|
| 382 | return (AdjustmentListener) removeInternal(l, oldl);
|
|---|
| 383 | }
|
|---|
| 384 |
|
|---|
| 385 | /**
|
|---|
| 386 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 387 | *
|
|---|
| 388 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 389 | * @param old The listener to remove.
|
|---|
| 390 | *
|
|---|
| 391 | * @return The resulting listener after the remove operation.
|
|---|
| 392 | */
|
|---|
| 393 | public static ComponentListener remove(ComponentListener l,
|
|---|
| 394 | ComponentListener oldl)
|
|---|
| 395 | {
|
|---|
| 396 | return (ComponentListener) removeInternal(l, oldl);
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | /**
|
|---|
| 400 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 401 | *
|
|---|
| 402 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 403 | * @param old The listener to remove.
|
|---|
| 404 | *
|
|---|
| 405 | * @return The resulting listener after the remove operation.
|
|---|
| 406 | */
|
|---|
| 407 | public static ContainerListener remove(ContainerListener l,
|
|---|
| 408 | ContainerListener oldl)
|
|---|
| 409 | {
|
|---|
| 410 | return (ContainerListener) removeInternal(l, oldl);
|
|---|
| 411 | }
|
|---|
| 412 |
|
|---|
| 413 | /**
|
|---|
| 414 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 415 | *
|
|---|
| 416 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 417 | * @param old The listener to remove.
|
|---|
| 418 | *
|
|---|
| 419 | * @return The resulting listener after the remove operation.
|
|---|
| 420 | */
|
|---|
| 421 | public static FocusListener remove(FocusListener l, FocusListener oldl)
|
|---|
| 422 | {
|
|---|
| 423 | return (FocusListener) removeInternal(l, oldl);
|
|---|
| 424 | }
|
|---|
| 425 |
|
|---|
| 426 | public static HierarchyBoundsListener remove(HierarchyBoundsListener l,
|
|---|
| 427 | HierarchyBoundsListener oldl)
|
|---|
| 428 | {
|
|---|
| 429 | return (HierarchyBoundsListener) removeInternal(l, oldl);
|
|---|
| 430 | }
|
|---|
| 431 |
|
|---|
| 432 | public static HierarchyListener remove(HierarchyListener l,
|
|---|
| 433 | HierarchyListener oldl)
|
|---|
| 434 | {
|
|---|
| 435 | return (HierarchyListener) removeInternal(l, oldl);
|
|---|
| 436 | }
|
|---|
| 437 |
|
|---|
| 438 | public static InputMethodListener remove(InputMethodListener l,
|
|---|
| 439 | InputMethodListener oldl)
|
|---|
| 440 | {
|
|---|
| 441 | return (InputMethodListener) removeInternal(l, oldl);
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | /**
|
|---|
| 445 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 446 | *
|
|---|
| 447 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 448 | * @param old The listener to remove.
|
|---|
| 449 | *
|
|---|
| 450 | * @return The resulting listener after the remove operation.
|
|---|
| 451 | */
|
|---|
| 452 | public static ItemListener remove(ItemListener l, ItemListener oldl)
|
|---|
| 453 | {
|
|---|
| 454 | return (ItemListener) removeInternal(l, oldl);
|
|---|
| 455 | }
|
|---|
| 456 |
|
|---|
| 457 | /**
|
|---|
| 458 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 459 | *
|
|---|
| 460 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 461 | * @param old The listener to remove.
|
|---|
| 462 | *
|
|---|
| 463 | * @return The resulting listener after the remove operation.
|
|---|
| 464 | */
|
|---|
| 465 | public static KeyListener remove(KeyListener l, KeyListener oldl)
|
|---|
| 466 | {
|
|---|
| 467 | return (KeyListener) removeInternal(l, oldl);
|
|---|
| 468 | }
|
|---|
| 469 |
|
|---|
| 470 | /**
|
|---|
| 471 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 472 | *
|
|---|
| 473 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 474 | * @param old The listener to remove.
|
|---|
| 475 | *
|
|---|
| 476 | * @return The resulting listener after the remove operation.
|
|---|
| 477 | */
|
|---|
| 478 | public static MouseListener remove(MouseListener l, MouseListener oldl)
|
|---|
| 479 | {
|
|---|
| 480 | return (MouseListener) removeInternal(l, oldl);
|
|---|
| 481 | }
|
|---|
| 482 |
|
|---|
| 483 | /**
|
|---|
| 484 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 485 | *
|
|---|
| 486 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 487 | * @param old The listener to remove.
|
|---|
| 488 | *
|
|---|
| 489 | * @return The resulting listener after the remove operation.
|
|---|
| 490 | */
|
|---|
| 491 | public static MouseMotionListener remove(MouseMotionListener l,
|
|---|
| 492 | MouseMotionListener oldl)
|
|---|
| 493 | {
|
|---|
| 494 | return (MouseMotionListener) removeInternal(l, oldl);
|
|---|
| 495 | }
|
|---|
| 496 |
|
|---|
| 497 | /**
|
|---|
| 498 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 499 | *
|
|---|
| 500 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 501 | * @param old The listener to remove.
|
|---|
| 502 | *
|
|---|
| 503 | * @return The resulting listener after the remove operation.
|
|---|
| 504 | */
|
|---|
| 505 | public static TextListener remove(TextListener l, TextListener oldl)
|
|---|
| 506 | {
|
|---|
| 507 | return (TextListener) removeInternal(l, oldl);
|
|---|
| 508 | }
|
|---|
| 509 |
|
|---|
| 510 | /**
|
|---|
| 511 | * Removes the listener <code>old</code> from the listener <code>lis</code>.
|
|---|
| 512 | *
|
|---|
| 513 | * @param lis The listener to remove <code>old</code> from.
|
|---|
| 514 | * @param old The listener to remove.
|
|---|
| 515 | *
|
|---|
| 516 | * @return The resulting listener after the remove operation.
|
|---|
| 517 | */
|
|---|
| 518 | public static WindowListener remove(WindowListener l, WindowListener oldl)
|
|---|
| 519 | {
|
|---|
| 520 | return (WindowListener) removeInternal(l, oldl);
|
|---|
| 521 | }
|
|---|
| 522 |
|
|---|
| 523 | /**
|
|---|
| 524 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 525 | * instances.
|
|---|
| 526 | *
|
|---|
| 527 | * @param event The event to handle.
|
|---|
| 528 | */
|
|---|
| 529 | public void actionPerformed(ActionEvent e)
|
|---|
| 530 | {
|
|---|
| 531 | ((ActionListener) a).actionPerformed(e);
|
|---|
| 532 | ((ActionListener) b).actionPerformed(e);
|
|---|
| 533 | }
|
|---|
| 534 |
|
|---|
| 535 | /**
|
|---|
| 536 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 537 | * instances.
|
|---|
| 538 | *
|
|---|
| 539 | * @param event The event to handle.
|
|---|
| 540 | */
|
|---|
| 541 | public void adjustmentValueChanged(AdjustmentEvent e)
|
|---|
| 542 | {
|
|---|
| 543 | ((AdjustmentListener) a).adjustmentValueChanged(e);
|
|---|
| 544 | ((AdjustmentListener) b).adjustmentValueChanged(e);
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | /**
|
|---|
| 548 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 549 | * instances.
|
|---|
| 550 | *
|
|---|
| 551 | * @param event The event to handle.
|
|---|
| 552 | */
|
|---|
| 553 | public void componentHidden(ComponentEvent e)
|
|---|
| 554 | {
|
|---|
| 555 | ((ComponentListener) a).componentHidden(e);
|
|---|
| 556 | ((ComponentListener) b).componentHidden(e);
|
|---|
| 557 | }
|
|---|
| 558 |
|
|---|
| 559 | /**
|
|---|
| 560 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 561 | * instances.
|
|---|
| 562 | *
|
|---|
| 563 | * @param event The event to handle.
|
|---|
| 564 | */
|
|---|
| 565 | public void componentMoved(ComponentEvent e)
|
|---|
| 566 | {
|
|---|
| 567 | ((ComponentListener) a).componentMoved(e);
|
|---|
| 568 | ((ComponentListener) b).componentMoved(e);
|
|---|
| 569 | }
|
|---|
| 570 |
|
|---|
| 571 | /**
|
|---|
| 572 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 573 | * instances.
|
|---|
| 574 | *
|
|---|
| 575 | * @param event The event to handle.
|
|---|
| 576 | */
|
|---|
| 577 | public void componentResized(ComponentEvent e)
|
|---|
| 578 | {
|
|---|
| 579 | ((ComponentListener) a).componentResized(e);
|
|---|
| 580 | ((ComponentListener) b).componentResized(e);
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | /**
|
|---|
| 584 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 585 | * instances.
|
|---|
| 586 | *
|
|---|
| 587 | * @param event The event to handle.
|
|---|
| 588 | */
|
|---|
| 589 | public void componentShown(ComponentEvent e)
|
|---|
| 590 | {
|
|---|
| 591 | ((ComponentListener) a).componentShown(e);
|
|---|
| 592 | ((ComponentListener) b).componentShown(e);
|
|---|
| 593 | }
|
|---|
| 594 |
|
|---|
| 595 | /**
|
|---|
| 596 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 597 | * instances.
|
|---|
| 598 | *
|
|---|
| 599 | * @param event The event to handle.
|
|---|
| 600 | */
|
|---|
| 601 | public void componentAdded(ContainerEvent e)
|
|---|
| 602 | {
|
|---|
| 603 | ((ContainerListener) a).componentAdded(e);
|
|---|
| 604 | ((ContainerListener) b).componentAdded(e);
|
|---|
| 605 | }
|
|---|
| 606 |
|
|---|
| 607 | /**
|
|---|
| 608 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 609 | * instances.
|
|---|
| 610 | *
|
|---|
| 611 | * @param event The event to handle.
|
|---|
| 612 | */
|
|---|
| 613 | public void componentRemoved(ContainerEvent e)
|
|---|
| 614 | {
|
|---|
| 615 | ((ContainerListener) a).componentRemoved(e);
|
|---|
| 616 | ((ContainerListener) b).componentRemoved(e);
|
|---|
| 617 | }
|
|---|
| 618 |
|
|---|
| 619 | /**
|
|---|
| 620 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 621 | * instances.
|
|---|
| 622 | *
|
|---|
| 623 | * @param event The event to handle.
|
|---|
| 624 | */
|
|---|
| 625 | public void focusGained(FocusEvent e)
|
|---|
| 626 | {
|
|---|
| 627 | ((FocusListener) a).focusGained(e);
|
|---|
| 628 | ((FocusListener) b).focusGained(e);
|
|---|
| 629 | }
|
|---|
| 630 |
|
|---|
| 631 | /**
|
|---|
| 632 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 633 | * instances.
|
|---|
| 634 | *
|
|---|
| 635 | * @param event The event to handle.
|
|---|
| 636 | */
|
|---|
| 637 | public void focusLost(FocusEvent e)
|
|---|
| 638 | {
|
|---|
| 639 | ((FocusListener) a).focusLost(e);
|
|---|
| 640 | ((FocusListener) b).focusLost(e);
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | /**
|
|---|
| 644 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 645 | * instances.
|
|---|
| 646 | *
|
|---|
| 647 | * @param event The event to handle.
|
|---|
| 648 | */
|
|---|
| 649 | public void ancestorMoved(HierarchyEvent e)
|
|---|
| 650 | {
|
|---|
| 651 | ((HierarchyBoundsListener) a).ancestorMoved(e);
|
|---|
| 652 | ((HierarchyBoundsListener) b).ancestorMoved(e);
|
|---|
| 653 | }
|
|---|
| 654 |
|
|---|
| 655 | /**
|
|---|
| 656 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 657 | * instances.
|
|---|
| 658 | *
|
|---|
| 659 | * @param event The event to handle.
|
|---|
| 660 | */
|
|---|
| 661 | public void ancestorResized(HierarchyEvent e)
|
|---|
| 662 | {
|
|---|
| 663 | ((HierarchyBoundsListener) a).ancestorResized(e);
|
|---|
| 664 | ((HierarchyBoundsListener) b).ancestorResized(e);
|
|---|
| 665 | }
|
|---|
| 666 |
|
|---|
| 667 | /**
|
|---|
| 668 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 669 | * instances.
|
|---|
| 670 | *
|
|---|
| 671 | * @param event The event to handle.
|
|---|
| 672 | */
|
|---|
| 673 | public void hierarchyChanged(HierarchyEvent e)
|
|---|
| 674 | {
|
|---|
| 675 | ((HierarchyListener) a).hierarchyChanged(e);
|
|---|
| 676 | ((HierarchyListener) b).hierarchyChanged(e);
|
|---|
| 677 | }
|
|---|
| 678 |
|
|---|
| 679 | /**
|
|---|
| 680 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 681 | * instances.
|
|---|
| 682 | *
|
|---|
| 683 | * @param event The event to handle.
|
|---|
| 684 | */
|
|---|
| 685 | public void caretPositionChanged(InputMethodEvent e)
|
|---|
| 686 | {
|
|---|
| 687 | ((InputMethodListener) a).caretPositionChanged(e);
|
|---|
| 688 | ((InputMethodListener) b).caretPositionChanged(e);
|
|---|
| 689 | }
|
|---|
| 690 |
|
|---|
| 691 | /**
|
|---|
| 692 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 693 | * instances.
|
|---|
| 694 | *
|
|---|
| 695 | * @param event The event to handle.
|
|---|
| 696 | */
|
|---|
| 697 | public void inputMethodTextChanged(InputMethodEvent e)
|
|---|
| 698 | {
|
|---|
| 699 | ((InputMethodListener) a).inputMethodTextChanged(e);
|
|---|
| 700 | ((InputMethodListener) b).inputMethodTextChanged(e);
|
|---|
| 701 | }
|
|---|
| 702 |
|
|---|
| 703 | /**
|
|---|
| 704 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 705 | * instances.
|
|---|
| 706 | *
|
|---|
| 707 | * @param event The event to handle.
|
|---|
| 708 | */
|
|---|
| 709 | public void itemStateChanged(ItemEvent e)
|
|---|
| 710 | {
|
|---|
| 711 | ((ItemListener) a).itemStateChanged(e);
|
|---|
| 712 | ((ItemListener) b).itemStateChanged(e);
|
|---|
| 713 | }
|
|---|
| 714 |
|
|---|
| 715 | /**
|
|---|
| 716 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 717 | * instances.
|
|---|
| 718 | *
|
|---|
| 719 | * @param event The event to handle.
|
|---|
| 720 | */
|
|---|
| 721 | public void keyPressed(KeyEvent e)
|
|---|
| 722 | {
|
|---|
| 723 | ((KeyListener) a).keyPressed(e);
|
|---|
| 724 | ((KeyListener) b).keyPressed(e);
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 | /**
|
|---|
| 728 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 729 | * instances.
|
|---|
| 730 | *
|
|---|
| 731 | * @param event The event to handle.
|
|---|
| 732 | */
|
|---|
| 733 | public void keyReleased(KeyEvent e)
|
|---|
| 734 | {
|
|---|
| 735 | ((KeyListener) a).keyReleased(e);
|
|---|
| 736 | ((KeyListener) b).keyReleased(e);
|
|---|
| 737 | }
|
|---|
| 738 |
|
|---|
| 739 | /**
|
|---|
| 740 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 741 | * instances.
|
|---|
| 742 | *
|
|---|
| 743 | * @param event The event to handle.
|
|---|
| 744 | */
|
|---|
| 745 | public void keyTyped(KeyEvent e)
|
|---|
| 746 | {
|
|---|
| 747 | ((KeyListener) a).keyTyped(e);
|
|---|
| 748 | ((KeyListener) b).keyTyped(e);
|
|---|
| 749 | }
|
|---|
| 750 |
|
|---|
| 751 | /**
|
|---|
| 752 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 753 | * instances.
|
|---|
| 754 | *
|
|---|
| 755 | * @param event The event to handle.
|
|---|
| 756 | */
|
|---|
| 757 | public void mouseClicked(MouseEvent e)
|
|---|
| 758 | {
|
|---|
| 759 | ((MouseListener) a).mouseClicked(e);
|
|---|
| 760 | ((MouseListener) b).mouseClicked(e);
|
|---|
| 761 | }
|
|---|
| 762 |
|
|---|
| 763 | /**
|
|---|
| 764 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 765 | * instances.
|
|---|
| 766 | *
|
|---|
| 767 | * @param event The event to handle.
|
|---|
| 768 | */
|
|---|
| 769 | public void mouseEntered(MouseEvent e)
|
|---|
| 770 | {
|
|---|
| 771 | ((MouseListener) a).mouseEntered(e);
|
|---|
| 772 | ((MouseListener) b).mouseEntered(e);
|
|---|
| 773 | }
|
|---|
| 774 |
|
|---|
| 775 | /**
|
|---|
| 776 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 777 | * instances.
|
|---|
| 778 | *
|
|---|
| 779 | * @param event The event to handle.
|
|---|
| 780 | */
|
|---|
| 781 | public void mouseExited(MouseEvent e)
|
|---|
| 782 | {
|
|---|
| 783 | ((MouseListener) a).mouseExited(e);
|
|---|
| 784 | ((MouseListener) b).mouseExited(e);
|
|---|
| 785 | }
|
|---|
| 786 |
|
|---|
| 787 | /**
|
|---|
| 788 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 789 | * instances.
|
|---|
| 790 | *
|
|---|
| 791 | * @param event The event to handle.
|
|---|
| 792 | */
|
|---|
| 793 | public void mousePressed(MouseEvent e)
|
|---|
| 794 | {
|
|---|
| 795 | ((MouseListener) a).mousePressed(e);
|
|---|
| 796 | ((MouseListener) b).mousePressed(e);
|
|---|
| 797 | }
|
|---|
| 798 |
|
|---|
| 799 | /**
|
|---|
| 800 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 801 | * instances.
|
|---|
| 802 | *
|
|---|
| 803 | * @param event The event to handle.
|
|---|
| 804 | */
|
|---|
| 805 | public void mouseReleased(MouseEvent e)
|
|---|
| 806 | {
|
|---|
| 807 | ((MouseListener) a).mouseReleased(e);
|
|---|
| 808 | ((MouseListener) b).mouseReleased(e);
|
|---|
| 809 | }
|
|---|
| 810 |
|
|---|
| 811 | /**
|
|---|
| 812 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 813 | * instances.
|
|---|
| 814 | *
|
|---|
| 815 | * @param event The event to handle.
|
|---|
| 816 | */
|
|---|
| 817 | public void mouseDragged(MouseEvent e)
|
|---|
| 818 | {
|
|---|
| 819 | ((MouseMotionListener) a).mouseDragged(e);
|
|---|
| 820 | ((MouseMotionListener) b).mouseDragged(e);
|
|---|
| 821 | }
|
|---|
| 822 |
|
|---|
| 823 | /**
|
|---|
| 824 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 825 | * instances.
|
|---|
| 826 | *
|
|---|
| 827 | * @param event The event to handle.
|
|---|
| 828 | */
|
|---|
| 829 | public void mouseMoved(MouseEvent e)
|
|---|
| 830 | {
|
|---|
| 831 | ((MouseMotionListener) a).mouseMoved(e);
|
|---|
| 832 | ((MouseMotionListener) b).mouseMoved(e);
|
|---|
| 833 | }
|
|---|
| 834 |
|
|---|
| 835 | /**
|
|---|
| 836 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 837 | * instances.
|
|---|
| 838 | *
|
|---|
| 839 | * @param event The event to handle.
|
|---|
| 840 | */
|
|---|
| 841 | public void textValueChanged(TextEvent e)
|
|---|
| 842 | {
|
|---|
| 843 | ((TextListener) a).textValueChanged(e);
|
|---|
| 844 | ((TextListener) b).textValueChanged(e);
|
|---|
| 845 | }
|
|---|
| 846 |
|
|---|
| 847 | /**
|
|---|
| 848 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 849 | * instances.
|
|---|
| 850 | *
|
|---|
| 851 | * @param event The event to handle.
|
|---|
| 852 | */
|
|---|
| 853 | public void windowActivated(WindowEvent e)
|
|---|
| 854 | {
|
|---|
| 855 | ((WindowListener) a).windowActivated(e);
|
|---|
| 856 | ((WindowListener) b).windowActivated(e);
|
|---|
| 857 | }
|
|---|
| 858 |
|
|---|
| 859 | /**
|
|---|
| 860 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 861 | * instances.
|
|---|
| 862 | *
|
|---|
| 863 | * @param event The event to handle.
|
|---|
| 864 | */
|
|---|
| 865 | public void windowClosed(WindowEvent e)
|
|---|
| 866 | {
|
|---|
| 867 | ((WindowListener) a).windowClosed(e);
|
|---|
| 868 | ((WindowListener) b).windowClosed(e);
|
|---|
| 869 | }
|
|---|
| 870 |
|
|---|
| 871 | /**
|
|---|
| 872 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 873 | * instances.
|
|---|
| 874 | *
|
|---|
| 875 | * @param event The event to handle.
|
|---|
| 876 | */
|
|---|
| 877 | public void windowClosing(WindowEvent e)
|
|---|
| 878 | {
|
|---|
| 879 | ((WindowListener) a).windowClosing(e);
|
|---|
| 880 | ((WindowListener) b).windowClosing(e);
|
|---|
| 881 | }
|
|---|
| 882 |
|
|---|
| 883 | /**
|
|---|
| 884 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 885 | * instances.
|
|---|
| 886 | *
|
|---|
| 887 | * @param event The event to handle.
|
|---|
| 888 | */
|
|---|
| 889 | public void windowDeactivated(WindowEvent e)
|
|---|
| 890 | {
|
|---|
| 891 | ((WindowListener) a).windowDeactivated(e);
|
|---|
| 892 | ((WindowListener) b).windowDeactivated(e);
|
|---|
| 893 | }
|
|---|
| 894 |
|
|---|
| 895 | /**
|
|---|
| 896 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 897 | * instances.
|
|---|
| 898 | *
|
|---|
| 899 | * @param event The event to handle.
|
|---|
| 900 | */
|
|---|
| 901 | public void windowDeiconified(WindowEvent e)
|
|---|
| 902 | {
|
|---|
| 903 | ((WindowListener) a).windowDeiconified(e);
|
|---|
| 904 | ((WindowListener) b).windowDeiconified(e);
|
|---|
| 905 | }
|
|---|
| 906 |
|
|---|
| 907 | /**
|
|---|
| 908 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 909 | * instances.
|
|---|
| 910 | *
|
|---|
| 911 | * @param event The event to handle.
|
|---|
| 912 | */
|
|---|
| 913 | public void windowIconified(WindowEvent e)
|
|---|
| 914 | {
|
|---|
| 915 | ((WindowListener) a).windowIconified(e);
|
|---|
| 916 | ((WindowListener) b).windowIconified(e);
|
|---|
| 917 | }
|
|---|
| 918 |
|
|---|
| 919 | /**
|
|---|
| 920 | * Handles this event by dispatching it to the "a" and "b" listener
|
|---|
| 921 | * instances.
|
|---|
| 922 | *
|
|---|
| 923 | * @param event The event to handle.
|
|---|
| 924 | */
|
|---|
| 925 | public void windowOpened(WindowEvent e)
|
|---|
| 926 | {
|
|---|
| 927 | ((WindowListener) a).windowOpened(e);
|
|---|
| 928 | ((WindowListener) b).windowOpened(e);
|
|---|
| 929 | }
|
|---|
| 930 |
|
|---|
| 931 | protected static void save(ObjectOutputStream s, String k, EventListener l)
|
|---|
| 932 | {
|
|---|
| 933 | throw new RuntimeException("Not Implemented");
|
|---|
| 934 | }
|
|---|
| 935 |
|
|---|
| 936 | protected void saveInternal(ObjectOutputStream s, String k)
|
|---|
| 937 | {
|
|---|
| 938 | throw new RuntimeException("Not Implemented");
|
|---|
| 939 | }
|
|---|
| 940 | }
|
|---|