OSDN Git Service

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