jdk/src/share/classes/java/awt/AWTEventMulticaster.java
changeset 25162 c388078278d4
parent 22282 cf7ce8b79a25
equal deleted inserted replaced
25161:c85a08c0b9d9 25162:c388078278d4
   108     MouseListener, MouseMotionListener, WindowListener, WindowFocusListener,
   108     MouseListener, MouseMotionListener, WindowListener, WindowFocusListener,
   109     WindowStateListener, ActionListener, ItemListener, AdjustmentListener,
   109     WindowStateListener, ActionListener, ItemListener, AdjustmentListener,
   110     TextListener, InputMethodListener, HierarchyListener,
   110     TextListener, InputMethodListener, HierarchyListener,
   111     HierarchyBoundsListener, MouseWheelListener {
   111     HierarchyBoundsListener, MouseWheelListener {
   112 
   112 
   113     protected final EventListener a, b;
   113     /**
       
   114      * A variable in the event chain (listener-a)
       
   115      */
       
   116     protected final EventListener a;
       
   117 
       
   118     /**
       
   119      * A variable in the event chain (listener-b)
       
   120      */
       
   121     protected final EventListener b;
   114 
   122 
   115     /**
   123     /**
   116      * Creates an event multicaster instance which chains listener-a
   124      * Creates an event multicaster instance which chains listener-a
   117      * with listener-b. Input parameters <code>a</code> and <code>b</code>
   125      * with listener-b. Input parameters <code>a</code> and <code>b</code>
   118      * should not be <code>null</code>, though implementations may vary in
   126      * should not be <code>null</code>, though implementations may vary in
   535     /**
   543     /**
   536      * Adds component-listener-a with component-listener-b and
   544      * Adds component-listener-a with component-listener-b and
   537      * returns the resulting multicast listener.
   545      * returns the resulting multicast listener.
   538      * @param a component-listener-a
   546      * @param a component-listener-a
   539      * @param b component-listener-b
   547      * @param b component-listener-b
       
   548      * @return the resulting listener
   540      */
   549      */
   541     public static ComponentListener add(ComponentListener a, ComponentListener b) {
   550     public static ComponentListener add(ComponentListener a, ComponentListener b) {
   542         return (ComponentListener)addInternal(a, b);
   551         return (ComponentListener)addInternal(a, b);
   543     }
   552     }
   544 
   553 
   545     /**
   554     /**
   546      * Adds container-listener-a with container-listener-b and
   555      * Adds container-listener-a with container-listener-b and
   547      * returns the resulting multicast listener.
   556      * returns the resulting multicast listener.
   548      * @param a container-listener-a
   557      * @param a container-listener-a
   549      * @param b container-listener-b
   558      * @param b container-listener-b
       
   559      * @return the resulting listener
   550      */
   560      */
   551     public static ContainerListener add(ContainerListener a, ContainerListener b) {
   561     public static ContainerListener add(ContainerListener a, ContainerListener b) {
   552         return (ContainerListener)addInternal(a, b);
   562         return (ContainerListener)addInternal(a, b);
   553     }
   563     }
   554 
   564 
   555     /**
   565     /**
   556      * Adds focus-listener-a with focus-listener-b and
   566      * Adds focus-listener-a with focus-listener-b and
   557      * returns the resulting multicast listener.
   567      * returns the resulting multicast listener.
   558      * @param a focus-listener-a
   568      * @param a focus-listener-a
   559      * @param b focus-listener-b
   569      * @param b focus-listener-b
       
   570      * @return the resulting listener
   560      */
   571      */
   561     public static FocusListener add(FocusListener a, FocusListener b) {
   572     public static FocusListener add(FocusListener a, FocusListener b) {
   562         return (FocusListener)addInternal(a, b);
   573         return (FocusListener)addInternal(a, b);
   563     }
   574     }
   564 
   575 
   565     /**
   576     /**
   566      * Adds key-listener-a with key-listener-b and
   577      * Adds key-listener-a with key-listener-b and
   567      * returns the resulting multicast listener.
   578      * returns the resulting multicast listener.
   568      * @param a key-listener-a
   579      * @param a key-listener-a
   569      * @param b key-listener-b
   580      * @param b key-listener-b
       
   581      * @return the resulting listener
   570      */
   582      */
   571     public static KeyListener add(KeyListener a, KeyListener b) {
   583     public static KeyListener add(KeyListener a, KeyListener b) {
   572         return (KeyListener)addInternal(a, b);
   584         return (KeyListener)addInternal(a, b);
   573     }
   585     }
   574 
   586 
   575     /**
   587     /**
   576      * Adds mouse-listener-a with mouse-listener-b and
   588      * Adds mouse-listener-a with mouse-listener-b and
   577      * returns the resulting multicast listener.
   589      * returns the resulting multicast listener.
   578      * @param a mouse-listener-a
   590      * @param a mouse-listener-a
   579      * @param b mouse-listener-b
   591      * @param b mouse-listener-b
       
   592      * @return the resulting listener
   580      */
   593      */
   581     public static MouseListener add(MouseListener a, MouseListener b) {
   594     public static MouseListener add(MouseListener a, MouseListener b) {
   582         return (MouseListener)addInternal(a, b);
   595         return (MouseListener)addInternal(a, b);
   583     }
   596     }
   584 
   597 
   585     /**
   598     /**
   586      * Adds mouse-motion-listener-a with mouse-motion-listener-b and
   599      * Adds mouse-motion-listener-a with mouse-motion-listener-b and
   587      * returns the resulting multicast listener.
   600      * returns the resulting multicast listener.
   588      * @param a mouse-motion-listener-a
   601      * @param a mouse-motion-listener-a
   589      * @param b mouse-motion-listener-b
   602      * @param b mouse-motion-listener-b
       
   603      * @return the resulting listener
   590      */
   604      */
   591     public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b) {
   605     public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b) {
   592         return (MouseMotionListener)addInternal(a, b);
   606         return (MouseMotionListener)addInternal(a, b);
   593     }
   607     }
   594 
   608 
   595     /**
   609     /**
   596      * Adds window-listener-a with window-listener-b and
   610      * Adds window-listener-a with window-listener-b and
   597      * returns the resulting multicast listener.
   611      * returns the resulting multicast listener.
   598      * @param a window-listener-a
   612      * @param a window-listener-a
   599      * @param b window-listener-b
   613      * @param b window-listener-b
       
   614      * @return the resulting listener
   600      */
   615      */
   601     public static WindowListener add(WindowListener a, WindowListener b) {
   616     public static WindowListener add(WindowListener a, WindowListener b) {
   602         return (WindowListener)addInternal(a, b);
   617         return (WindowListener)addInternal(a, b);
   603     }
   618     }
   604 
   619 
   605     /**
   620     /**
   606      * Adds window-state-listener-a with window-state-listener-b
   621      * Adds window-state-listener-a with window-state-listener-b
   607      * and returns the resulting multicast listener.
   622      * and returns the resulting multicast listener.
   608      * @param a window-state-listener-a
   623      * @param a window-state-listener-a
   609      * @param b window-state-listener-b
   624      * @param b window-state-listener-b
       
   625      * @return the resulting listener
   610      * @since 1.4
   626      * @since 1.4
   611      */
   627      */
   612     @SuppressWarnings("overloads")
   628     @SuppressWarnings("overloads")
   613     public static WindowStateListener add(WindowStateListener a,
   629     public static WindowStateListener add(WindowStateListener a,
   614                                           WindowStateListener b) {
   630                                           WindowStateListener b) {
   618     /**
   634     /**
   619      * Adds window-focus-listener-a with window-focus-listener-b
   635      * Adds window-focus-listener-a with window-focus-listener-b
   620      * and returns the resulting multicast listener.
   636      * and returns the resulting multicast listener.
   621      * @param a window-focus-listener-a
   637      * @param a window-focus-listener-a
   622      * @param b window-focus-listener-b
   638      * @param b window-focus-listener-b
       
   639      * @return the resulting listener
   623      * @since 1.4
   640      * @since 1.4
   624      */
   641      */
   625     public static WindowFocusListener add(WindowFocusListener a,
   642     public static WindowFocusListener add(WindowFocusListener a,
   626                                           WindowFocusListener b) {
   643                                           WindowFocusListener b) {
   627         return (WindowFocusListener)addInternal(a, b);
   644         return (WindowFocusListener)addInternal(a, b);
   630     /**
   647     /**
   631      * Adds action-listener-a with action-listener-b and
   648      * Adds action-listener-a with action-listener-b and
   632      * returns the resulting multicast listener.
   649      * returns the resulting multicast listener.
   633      * @param a action-listener-a
   650      * @param a action-listener-a
   634      * @param b action-listener-b
   651      * @param b action-listener-b
       
   652      * @return the resulting listener
   635      */
   653      */
   636     @SuppressWarnings("overloads")
   654     @SuppressWarnings("overloads")
   637     public static ActionListener add(ActionListener a, ActionListener b) {
   655     public static ActionListener add(ActionListener a, ActionListener b) {
   638         return (ActionListener)addInternal(a, b);
   656         return (ActionListener)addInternal(a, b);
   639     }
   657     }
   641     /**
   659     /**
   642      * Adds item-listener-a with item-listener-b and
   660      * Adds item-listener-a with item-listener-b and
   643      * returns the resulting multicast listener.
   661      * returns the resulting multicast listener.
   644      * @param a item-listener-a
   662      * @param a item-listener-a
   645      * @param b item-listener-b
   663      * @param b item-listener-b
       
   664      * @return the resulting listener
   646      */
   665      */
   647     @SuppressWarnings("overloads")
   666     @SuppressWarnings("overloads")
   648     public static ItemListener add(ItemListener a, ItemListener b) {
   667     public static ItemListener add(ItemListener a, ItemListener b) {
   649         return (ItemListener)addInternal(a, b);
   668         return (ItemListener)addInternal(a, b);
   650     }
   669     }
   652     /**
   671     /**
   653      * Adds adjustment-listener-a with adjustment-listener-b and
   672      * Adds adjustment-listener-a with adjustment-listener-b and
   654      * returns the resulting multicast listener.
   673      * returns the resulting multicast listener.
   655      * @param a adjustment-listener-a
   674      * @param a adjustment-listener-a
   656      * @param b adjustment-listener-b
   675      * @param b adjustment-listener-b
       
   676      * @return the resulting listener
   657      */
   677      */
   658     @SuppressWarnings("overloads")
   678     @SuppressWarnings("overloads")
   659     public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b) {
   679     public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b) {
   660         return (AdjustmentListener)addInternal(a, b);
   680         return (AdjustmentListener)addInternal(a, b);
   661     }
   681     }
       
   682 
       
   683     /**
       
   684      * Adds text-listener-a with text-listener-b and
       
   685      * returns the resulting multicast listener.
       
   686      *
       
   687      * @param  a text-listener-a
       
   688      * @param  b text-listener-b
       
   689      * @return the resulting listener
       
   690      */
   662     @SuppressWarnings("overloads")
   691     @SuppressWarnings("overloads")
   663     public static TextListener add(TextListener a, TextListener b) {
   692     public static TextListener add(TextListener a, TextListener b) {
   664         return (TextListener)addInternal(a, b);
   693         return (TextListener)addInternal(a, b);
   665     }
   694     }
   666 
   695 
   667     /**
   696     /**
   668      * Adds input-method-listener-a with input-method-listener-b and
   697      * Adds input-method-listener-a with input-method-listener-b and
   669      * returns the resulting multicast listener.
   698      * returns the resulting multicast listener.
   670      * @param a input-method-listener-a
   699      * @param a input-method-listener-a
   671      * @param b input-method-listener-b
   700      * @param b input-method-listener-b
       
   701      * @return the resulting listener
   672      */
   702      */
   673      public static InputMethodListener add(InputMethodListener a, InputMethodListener b) {
   703      public static InputMethodListener add(InputMethodListener a, InputMethodListener b) {
   674         return (InputMethodListener)addInternal(a, b);
   704         return (InputMethodListener)addInternal(a, b);
   675      }
   705      }
   676 
   706 
   677     /**
   707     /**
   678      * Adds hierarchy-listener-a with hierarchy-listener-b and
   708      * Adds hierarchy-listener-a with hierarchy-listener-b and
   679      * returns the resulting multicast listener.
   709      * returns the resulting multicast listener.
   680      * @param a hierarchy-listener-a
   710      * @param a hierarchy-listener-a
   681      * @param b hierarchy-listener-b
   711      * @param b hierarchy-listener-b
       
   712      * @return the resulting listener
   682      * @since 1.3
   713      * @since 1.3
   683      */
   714      */
   684     @SuppressWarnings("overloads")
   715     @SuppressWarnings("overloads")
   685      public static HierarchyListener add(HierarchyListener a, HierarchyListener b) {
   716      public static HierarchyListener add(HierarchyListener a, HierarchyListener b) {
   686         return (HierarchyListener)addInternal(a, b);
   717         return (HierarchyListener)addInternal(a, b);
   689     /**
   720     /**
   690      * Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and
   721      * Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and
   691      * returns the resulting multicast listener.
   722      * returns the resulting multicast listener.
   692      * @param a hierarchy-bounds-listener-a
   723      * @param a hierarchy-bounds-listener-a
   693      * @param b hierarchy-bounds-listener-b
   724      * @param b hierarchy-bounds-listener-b
       
   725      * @return the resulting listener
   694      * @since 1.3
   726      * @since 1.3
   695      */
   727      */
   696      public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b) {
   728      public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b) {
   697         return (HierarchyBoundsListener)addInternal(a, b);
   729         return (HierarchyBoundsListener)addInternal(a, b);
   698      }
   730      }
   700     /**
   732     /**
   701      * Adds mouse-wheel-listener-a with mouse-wheel-listener-b and
   733      * Adds mouse-wheel-listener-a with mouse-wheel-listener-b and
   702      * returns the resulting multicast listener.
   734      * returns the resulting multicast listener.
   703      * @param a mouse-wheel-listener-a
   735      * @param a mouse-wheel-listener-a
   704      * @param b mouse-wheel-listener-b
   736      * @param b mouse-wheel-listener-b
       
   737      * @return the resulting listener
   705      * @since 1.4
   738      * @since 1.4
   706      */
   739      */
   707     @SuppressWarnings("overloads")
   740     @SuppressWarnings("overloads")
   708     public static MouseWheelListener add(MouseWheelListener a,
   741     public static MouseWheelListener add(MouseWheelListener a,
   709                                          MouseWheelListener b) {
   742                                          MouseWheelListener b) {
   713     /**
   746     /**
   714      * Removes the old component-listener from component-listener-l and
   747      * Removes the old component-listener from component-listener-l and
   715      * returns the resulting multicast listener.
   748      * returns the resulting multicast listener.
   716      * @param l component-listener-l
   749      * @param l component-listener-l
   717      * @param oldl the component-listener being removed
   750      * @param oldl the component-listener being removed
       
   751      * @return the resulting listener
   718      */
   752      */
   719     public static ComponentListener remove(ComponentListener l, ComponentListener oldl) {
   753     public static ComponentListener remove(ComponentListener l, ComponentListener oldl) {
   720         return (ComponentListener) removeInternal(l, oldl);
   754         return (ComponentListener) removeInternal(l, oldl);
   721     }
   755     }
   722 
   756 
   723     /**
   757     /**
   724      * Removes the old container-listener from container-listener-l and
   758      * Removes the old container-listener from container-listener-l and
   725      * returns the resulting multicast listener.
   759      * returns the resulting multicast listener.
   726      * @param l container-listener-l
   760      * @param l container-listener-l
   727      * @param oldl the container-listener being removed
   761      * @param oldl the container-listener being removed
       
   762      * @return the resulting listener
   728      */
   763      */
   729     public static ContainerListener remove(ContainerListener l, ContainerListener oldl) {
   764     public static ContainerListener remove(ContainerListener l, ContainerListener oldl) {
   730         return (ContainerListener) removeInternal(l, oldl);
   765         return (ContainerListener) removeInternal(l, oldl);
   731     }
   766     }
   732 
   767 
   733     /**
   768     /**
   734      * Removes the old focus-listener from focus-listener-l and
   769      * Removes the old focus-listener from focus-listener-l and
   735      * returns the resulting multicast listener.
   770      * returns the resulting multicast listener.
   736      * @param l focus-listener-l
   771      * @param l focus-listener-l
   737      * @param oldl the focus-listener being removed
   772      * @param oldl the focus-listener being removed
       
   773      * @return the resulting listener
   738      */
   774      */
   739     public static FocusListener remove(FocusListener l, FocusListener oldl) {
   775     public static FocusListener remove(FocusListener l, FocusListener oldl) {
   740         return (FocusListener) removeInternal(l, oldl);
   776         return (FocusListener) removeInternal(l, oldl);
   741     }
   777     }
   742 
   778 
   743     /**
   779     /**
   744      * Removes the old key-listener from key-listener-l and
   780      * Removes the old key-listener from key-listener-l and
   745      * returns the resulting multicast listener.
   781      * returns the resulting multicast listener.
   746      * @param l key-listener-l
   782      * @param l key-listener-l
   747      * @param oldl the key-listener being removed
   783      * @param oldl the key-listener being removed
       
   784      * @return the resulting listener
   748      */
   785      */
   749     public static KeyListener remove(KeyListener l, KeyListener oldl) {
   786     public static KeyListener remove(KeyListener l, KeyListener oldl) {
   750         return (KeyListener) removeInternal(l, oldl);
   787         return (KeyListener) removeInternal(l, oldl);
   751     }
   788     }
   752 
   789 
   753     /**
   790     /**
   754      * Removes the old mouse-listener from mouse-listener-l and
   791      * Removes the old mouse-listener from mouse-listener-l and
   755      * returns the resulting multicast listener.
   792      * returns the resulting multicast listener.
   756      * @param l mouse-listener-l
   793      * @param l mouse-listener-l
   757      * @param oldl the mouse-listener being removed
   794      * @param oldl the mouse-listener being removed
       
   795      * @return the resulting listener
   758      */
   796      */
   759     public static MouseListener remove(MouseListener l, MouseListener oldl) {
   797     public static MouseListener remove(MouseListener l, MouseListener oldl) {
   760         return (MouseListener) removeInternal(l, oldl);
   798         return (MouseListener) removeInternal(l, oldl);
   761     }
   799     }
   762 
   800 
   763     /**
   801     /**
   764      * Removes the old mouse-motion-listener from mouse-motion-listener-l
   802      * Removes the old mouse-motion-listener from mouse-motion-listener-l
   765      * and returns the resulting multicast listener.
   803      * and returns the resulting multicast listener.
   766      * @param l mouse-motion-listener-l
   804      * @param l mouse-motion-listener-l
   767      * @param oldl the mouse-motion-listener being removed
   805      * @param oldl the mouse-motion-listener being removed
       
   806      * @return the resulting listener
   768      */
   807      */
   769     public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl) {
   808     public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl) {
   770         return (MouseMotionListener) removeInternal(l, oldl);
   809         return (MouseMotionListener) removeInternal(l, oldl);
   771     }
   810     }
   772 
   811 
   773     /**
   812     /**
   774      * Removes the old window-listener from window-listener-l and
   813      * Removes the old window-listener from window-listener-l and
   775      * returns the resulting multicast listener.
   814      * returns the resulting multicast listener.
   776      * @param l window-listener-l
   815      * @param l window-listener-l
   777      * @param oldl the window-listener being removed
   816      * @param oldl the window-listener being removed
       
   817      * @return the resulting listener
   778      */
   818      */
   779     public static WindowListener remove(WindowListener l, WindowListener oldl) {
   819     public static WindowListener remove(WindowListener l, WindowListener oldl) {
   780         return (WindowListener) removeInternal(l, oldl);
   820         return (WindowListener) removeInternal(l, oldl);
   781     }
   821     }
   782 
   822 
   783     /**
   823     /**
   784      * Removes the old window-state-listener from window-state-listener-l
   824      * Removes the old window-state-listener from window-state-listener-l
   785      * and returns the resulting multicast listener.
   825      * and returns the resulting multicast listener.
   786      * @param l window-state-listener-l
   826      * @param l window-state-listener-l
   787      * @param oldl the window-state-listener being removed
   827      * @param oldl the window-state-listener being removed
       
   828      * @return the resulting listener
   788      * @since 1.4
   829      * @since 1.4
   789      */
   830      */
   790     @SuppressWarnings("overloads")
   831     @SuppressWarnings("overloads")
   791     public static WindowStateListener remove(WindowStateListener l,
   832     public static WindowStateListener remove(WindowStateListener l,
   792                                              WindowStateListener oldl) {
   833                                              WindowStateListener oldl) {
   796     /**
   837     /**
   797      * Removes the old window-focus-listener from window-focus-listener-l
   838      * Removes the old window-focus-listener from window-focus-listener-l
   798      * and returns the resulting multicast listener.
   839      * and returns the resulting multicast listener.
   799      * @param l window-focus-listener-l
   840      * @param l window-focus-listener-l
   800      * @param oldl the window-focus-listener being removed
   841      * @param oldl the window-focus-listener being removed
       
   842      * @return the resulting listener
   801      * @since 1.4
   843      * @since 1.4
   802      */
   844      */
   803     public static WindowFocusListener remove(WindowFocusListener l,
   845     public static WindowFocusListener remove(WindowFocusListener l,
   804                                              WindowFocusListener oldl) {
   846                                              WindowFocusListener oldl) {
   805         return (WindowFocusListener) removeInternal(l, oldl);
   847         return (WindowFocusListener) removeInternal(l, oldl);
   808     /**
   850     /**
   809      * Removes the old action-listener from action-listener-l and
   851      * Removes the old action-listener from action-listener-l and
   810      * returns the resulting multicast listener.
   852      * returns the resulting multicast listener.
   811      * @param l action-listener-l
   853      * @param l action-listener-l
   812      * @param oldl the action-listener being removed
   854      * @param oldl the action-listener being removed
       
   855      * @return the resulting listener
   813      */
   856      */
   814     @SuppressWarnings("overloads")
   857     @SuppressWarnings("overloads")
   815     public static ActionListener remove(ActionListener l, ActionListener oldl) {
   858     public static ActionListener remove(ActionListener l, ActionListener oldl) {
   816         return (ActionListener) removeInternal(l, oldl);
   859         return (ActionListener) removeInternal(l, oldl);
   817     }
   860     }
   819     /**
   862     /**
   820      * Removes the old item-listener from item-listener-l and
   863      * Removes the old item-listener from item-listener-l and
   821      * returns the resulting multicast listener.
   864      * returns the resulting multicast listener.
   822      * @param l item-listener-l
   865      * @param l item-listener-l
   823      * @param oldl the item-listener being removed
   866      * @param oldl the item-listener being removed
       
   867      * @return the resulting listener
   824      */
   868      */
   825     @SuppressWarnings("overloads")
   869     @SuppressWarnings("overloads")
   826     public static ItemListener remove(ItemListener l, ItemListener oldl) {
   870     public static ItemListener remove(ItemListener l, ItemListener oldl) {
   827         return (ItemListener) removeInternal(l, oldl);
   871         return (ItemListener) removeInternal(l, oldl);
   828     }
   872     }
   830     /**
   874     /**
   831      * Removes the old adjustment-listener from adjustment-listener-l and
   875      * Removes the old adjustment-listener from adjustment-listener-l and
   832      * returns the resulting multicast listener.
   876      * returns the resulting multicast listener.
   833      * @param l adjustment-listener-l
   877      * @param l adjustment-listener-l
   834      * @param oldl the adjustment-listener being removed
   878      * @param oldl the adjustment-listener being removed
       
   879      * @return the resulting listener
   835      */
   880      */
   836     @SuppressWarnings("overloads")
   881     @SuppressWarnings("overloads")
   837     public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl) {
   882     public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl) {
   838         return (AdjustmentListener) removeInternal(l, oldl);
   883         return (AdjustmentListener) removeInternal(l, oldl);
   839     }
   884     }
       
   885 
       
   886     /**
       
   887      * Removes the old text-listener from text-listener-l and
       
   888      * returns the resulting multicast listener.
       
   889      *
       
   890      * @param  l text-listener-l
       
   891      * @param  oldl the text-listener being removed
       
   892      * @return the resulting listener
       
   893      */
   840     @SuppressWarnings("overloads")
   894     @SuppressWarnings("overloads")
   841     public static TextListener remove(TextListener l, TextListener oldl) {
   895     public static TextListener remove(TextListener l, TextListener oldl) {
   842         return (TextListener) removeInternal(l, oldl);
   896         return (TextListener) removeInternal(l, oldl);
   843     }
   897     }
   844 
   898 
   845     /**
   899     /**
   846      * Removes the old input-method-listener from input-method-listener-l and
   900      * Removes the old input-method-listener from input-method-listener-l and
   847      * returns the resulting multicast listener.
   901      * returns the resulting multicast listener.
   848      * @param l input-method-listener-l
   902      * @param l input-method-listener-l
   849      * @param oldl the input-method-listener being removed
   903      * @param oldl the input-method-listener being removed
       
   904      * @return the resulting listener
   850      */
   905      */
   851     public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl) {
   906     public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl) {
   852         return (InputMethodListener) removeInternal(l, oldl);
   907         return (InputMethodListener) removeInternal(l, oldl);
   853     }
   908     }
   854 
   909 
   855     /**
   910     /**
   856      * Removes the old hierarchy-listener from hierarchy-listener-l and
   911      * Removes the old hierarchy-listener from hierarchy-listener-l and
   857      * returns the resulting multicast listener.
   912      * returns the resulting multicast listener.
   858      * @param l hierarchy-listener-l
   913      * @param l hierarchy-listener-l
   859      * @param oldl the hierarchy-listener being removed
   914      * @param oldl the hierarchy-listener being removed
       
   915      * @return the resulting listener
   860      * @since 1.3
   916      * @since 1.3
   861      */
   917      */
   862     @SuppressWarnings("overloads")
   918     @SuppressWarnings("overloads")
   863     public static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl) {
   919     public static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl) {
   864         return (HierarchyListener) removeInternal(l, oldl);
   920         return (HierarchyListener) removeInternal(l, oldl);
   868      * Removes the old hierarchy-bounds-listener from
   924      * Removes the old hierarchy-bounds-listener from
   869      * hierarchy-bounds-listener-l and returns the resulting multicast
   925      * hierarchy-bounds-listener-l and returns the resulting multicast
   870      * listener.
   926      * listener.
   871      * @param l hierarchy-bounds-listener-l
   927      * @param l hierarchy-bounds-listener-l
   872      * @param oldl the hierarchy-bounds-listener being removed
   928      * @param oldl the hierarchy-bounds-listener being removed
       
   929      * @return the resulting listener
   873      * @since 1.3
   930      * @since 1.3
   874      */
   931      */
   875     public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl) {
   932     public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl) {
   876         return (HierarchyBoundsListener) removeInternal(l, oldl);
   933         return (HierarchyBoundsListener) removeInternal(l, oldl);
   877     }
   934     }
   879     /**
   936     /**
   880      * Removes the old mouse-wheel-listener from mouse-wheel-listener-l
   937      * Removes the old mouse-wheel-listener from mouse-wheel-listener-l
   881      * and returns the resulting multicast listener.
   938      * and returns the resulting multicast listener.
   882      * @param l mouse-wheel-listener-l
   939      * @param l mouse-wheel-listener-l
   883      * @param oldl the mouse-wheel-listener being removed
   940      * @param oldl the mouse-wheel-listener being removed
       
   941      * @return the resulting listener
   884      * @since 1.4
   942      * @since 1.4
   885      */
   943      */
   886     @SuppressWarnings("overloads")
   944     @SuppressWarnings("overloads")
   887     public static MouseWheelListener remove(MouseWheelListener l,
   945     public static MouseWheelListener remove(MouseWheelListener l,
   888                                             MouseWheelListener oldl) {
   946                                             MouseWheelListener oldl) {
   896      * If listener-b is null, it returns listener-a
   954      * If listener-b is null, it returns listener-a
   897      * If neither are null, then it creates and returns
   955      * If neither are null, then it creates and returns
   898      * a new AWTEventMulticaster instance which chains a with b.
   956      * a new AWTEventMulticaster instance which chains a with b.
   899      * @param a event listener-a
   957      * @param a event listener-a
   900      * @param b event listener-b
   958      * @param b event listener-b
       
   959      * @return the resulting listener
   901      */
   960      */
   902     protected static EventListener addInternal(EventListener a, EventListener b) {
   961     protected static EventListener addInternal(EventListener a, EventListener b) {
   903         if (a == null)  return b;
   962         if (a == null)  return b;
   904         if (b == null)  return a;
   963         if (b == null)  return a;
   905         return new AWTEventMulticaster(a, b);
   964         return new AWTEventMulticaster(a, b);
   913      * Else if listener-l is an instance of AWTEventMulticaster,
   972      * Else if listener-l is an instance of AWTEventMulticaster,
   914      * then it removes the old listener from it.
   973      * then it removes the old listener from it.
   915      * Else, returns listener l.
   974      * Else, returns listener l.
   916      * @param l the listener being removed from
   975      * @param l the listener being removed from
   917      * @param oldl the listener being removed
   976      * @param oldl the listener being removed
       
   977      * @return the resulting listener
   918      */
   978      */
   919     protected static EventListener removeInternal(EventListener l, EventListener oldl) {
   979     protected static EventListener removeInternal(EventListener l, EventListener oldl) {
   920         if (l == oldl || l == null) {
   980         if (l == oldl || l == null) {
   921             return null;
   981             return null;
   922         } else if (l instanceof AWTEventMulticaster) {
   982         } else if (l instanceof AWTEventMulticaster) {
   925             return l;           // it's not here
   985             return l;           // it's not here
   926         }
   986         }
   927     }
   987     }
   928 
   988 
   929 
   989 
   930     /* Serialization support.
   990    /**
   931      */
   991     * Serialization support. Saves all Serializable listeners
   932 
   992     * to a serialization stream.
       
   993     *
       
   994     * @param  s the stream to save to
       
   995     * @param  k a prefix stream to put before each serializable listener
       
   996     * @throws IOException if serialization fails
       
   997     */
   933     protected void saveInternal(ObjectOutputStream s, String k) throws IOException {
   998     protected void saveInternal(ObjectOutputStream s, String k) throws IOException {
   934         if (a instanceof AWTEventMulticaster) {
   999         if (a instanceof AWTEventMulticaster) {
   935             ((AWTEventMulticaster)a).saveInternal(s, k);
  1000             ((AWTEventMulticaster)a).saveInternal(s, k);
   936         }
  1001         }
   937         else if (a instanceof Serializable) {
  1002         else if (a instanceof Serializable) {
   946             s.writeObject(k);
  1011             s.writeObject(k);
   947             s.writeObject(b);
  1012             s.writeObject(b);
   948         }
  1013         }
   949     }
  1014     }
   950 
  1015 
       
  1016    /**
       
  1017     * Saves a Serializable listener chain to a serialization stream.
       
  1018     *
       
  1019     * @param  s the stream to save to
       
  1020     * @param  k a prefix stream to put before each serializable listener
       
  1021     * @param  l the listener chain to save
       
  1022     * @throws IOException if serialization fails
       
  1023     */
   951     protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException {
  1024     protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException {
   952       if (l == null) {
  1025       if (l == null) {
   953           return;
  1026           return;
   954       }
  1027       }
   955       else if (l instanceof AWTEventMulticaster) {
  1028       else if (l instanceof AWTEventMulticaster) {