jdk/src/share/classes/java/awt/AWTEventMulticaster.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 11270 d7b0b63bd082
child 22282 cf7ce8b79a25
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.awt.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.lang.reflect.Array;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.EventListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.EventListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * {@code AWTEventMulticaster} implements efficient and thread-safe multi-cast
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * event dispatching for the AWT events defined in the {@code java.awt.event}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * package.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * The following example illustrates how to use this class:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <pre><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * public myComponent extends Component {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *     ActionListener actionListener = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *     public synchronized void addActionListener(ActionListener l) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *         actionListener = AWTEventMulticaster.add(actionListener, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *     public synchronized void removeActionListener(ActionListener l) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *         actionListener = AWTEventMulticaster.remove(actionListener, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *     public void processEvent(AWTEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *         // when event occurs which causes "action" semantic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *         ActionListener listener = actionListener;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *         if (listener != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *             listener.actionPerformed(new ActionEvent());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * </code></pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * The important point to note is the first argument to the {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * add} and {@code remove} methods is the field maintaining the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * listeners. In addition you must assign the result of the {@code add}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * and {@code remove} methods to the field maintaining the listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * {@code AWTEventMulticaster} is implemented as a pair of {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * EventListeners} that are set at construction time. {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * AWTEventMulticaster} is immutable. The {@code add} and {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * remove} methods do not alter {@code AWTEventMulticaster} in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * anyway. If necessary, a new {@code AWTEventMulticaster} is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * created. In this way it is safe to add and remove listeners during
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * the process of an event dispatching.  However, event listeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * added during the process of an event dispatch operation are not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * notified of the event currently being dispatched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * All of the {@code add} methods allow {@code null} arguments. If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * first argument is {@code null}, the second argument is returned. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * the first argument is not {@code null} and the second argument is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * {@code null}, the first argument is returned. If both arguments are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * {@code non-null}, a new {@code AWTEventMulticaster} is created using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * the two arguments and returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * For the {@code remove} methods that take two arguments, the following is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * returned:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *   <li>{@code null}, if the first argument is {@code null}, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *       the arguments are equal, by way of {@code ==}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *   <li>the first argument, if the first argument is not an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *       {@code AWTEventMulticaster}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *   <li>result of invoking {@code remove(EventListener)} on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *       first argument, supplying the second argument to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *       {@code remove(EventListener)} method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * <p>Swing makes use of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * {@link javax.swing.event.EventListenerList EventListenerList} for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * similar logic. Refer to it for details.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @see javax.swing.event.EventListenerList
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * @author      John Rose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * @author      Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * @since       1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
public class AWTEventMulticaster implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    ComponentListener, ContainerListener, FocusListener, KeyListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    MouseListener, MouseMotionListener, WindowListener, WindowFocusListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    WindowStateListener, ActionListener, ItemListener, AdjustmentListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    TextListener, InputMethodListener, HierarchyListener,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    HierarchyBoundsListener, MouseWheelListener {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    protected final EventListener a, b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * Creates an event multicaster instance which chains listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * with listener-b. Input parameters <code>a</code> and <code>b</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * should not be <code>null</code>, though implementations may vary in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * choosing whether or not to throw <code>NullPointerException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * in that case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param a listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @param b listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    protected AWTEventMulticaster(EventListener a, EventListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        this.a = a; this.b = b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Removes a listener from this multicaster.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * The returned multicaster contains all the listeners in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * multicaster with the exception of all occurrences of {@code oldl}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * If the resulting multicaster contains only one regular listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * the regular listener may be returned.  If the resulting multicaster
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * is empty, then {@code null} may be returned instead.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * No exception is thrown if {@code oldl} is {@code null}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * @param oldl the listener to be removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * @return resulting listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    protected EventListener remove(EventListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        if (oldl == a)  return b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        if (oldl == b)  return a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        EventListener a2 = removeInternal(a, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        EventListener b2 = removeInternal(b, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        if (a2 == a && b2 == b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            return this;        // it's not here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        return addInternal(a2, b2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Handles the componentResized event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * componentResized methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public void componentResized(ComponentEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
        ((ComponentListener)a).componentResized(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        ((ComponentListener)b).componentResized(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Handles the componentMoved event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * componentMoved methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public void componentMoved(ComponentEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        ((ComponentListener)a).componentMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        ((ComponentListener)b).componentMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Handles the componentShown event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * componentShown methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    public void componentShown(ComponentEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        ((ComponentListener)a).componentShown(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        ((ComponentListener)b).componentShown(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Handles the componentHidden event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * componentHidden methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    public void componentHidden(ComponentEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        ((ComponentListener)a).componentHidden(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        ((ComponentListener)b).componentHidden(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * Handles the componentAdded container event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * componentAdded methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    public void componentAdded(ContainerEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        ((ContainerListener)a).componentAdded(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        ((ContainerListener)b).componentAdded(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * Handles the componentRemoved container event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * componentRemoved methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @param e the component event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public void componentRemoved(ContainerEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        ((ContainerListener)a).componentRemoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        ((ContainerListener)b).componentRemoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * Handles the focusGained event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * focusGained methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @param e the focus event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    public void focusGained(FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        ((FocusListener)a).focusGained(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        ((FocusListener)b).focusGained(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * Handles the focusLost event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * focusLost methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * @param e the focus event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public void focusLost(FocusEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        ((FocusListener)a).focusLost(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        ((FocusListener)b).focusLost(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * Handles the keyTyped event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * keyTyped methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @param e the key event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    public void keyTyped(KeyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        ((KeyListener)a).keyTyped(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        ((KeyListener)b).keyTyped(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * Handles the keyPressed event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * keyPressed methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @param e the key event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public void keyPressed(KeyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        ((KeyListener)a).keyPressed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        ((KeyListener)b).keyPressed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * Handles the keyReleased event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * keyReleased methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @param e the key event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    public void keyReleased(KeyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        ((KeyListener)a).keyReleased(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        ((KeyListener)b).keyReleased(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * Handles the mouseClicked event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * mouseClicked methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public void mouseClicked(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        ((MouseListener)a).mouseClicked(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        ((MouseListener)b).mouseClicked(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Handles the mousePressed event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * mousePressed methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public void mousePressed(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        ((MouseListener)a).mousePressed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        ((MouseListener)b).mousePressed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * Handles the mouseReleased event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * mouseReleased methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public void mouseReleased(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        ((MouseListener)a).mouseReleased(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        ((MouseListener)b).mouseReleased(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * Handles the mouseEntered event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * mouseEntered methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    public void mouseEntered(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        ((MouseListener)a).mouseEntered(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        ((MouseListener)b).mouseEntered(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * Handles the mouseExited event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * mouseExited methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    public void mouseExited(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        ((MouseListener)a).mouseExited(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        ((MouseListener)b).mouseExited(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * Handles the mouseDragged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * mouseDragged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public void mouseDragged(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        ((MouseMotionListener)a).mouseDragged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        ((MouseMotionListener)b).mouseDragged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * Handles the mouseMoved event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * mouseMoved methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    public void mouseMoved(MouseEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        ((MouseMotionListener)a).mouseMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        ((MouseMotionListener)b).mouseMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * Handles the windowOpened event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * windowOpened methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    public void windowOpened(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        ((WindowListener)a).windowOpened(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
        ((WindowListener)b).windowOpened(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * Handles the windowClosing event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * windowClosing methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    public void windowClosing(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        ((WindowListener)a).windowClosing(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        ((WindowListener)b).windowClosing(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * Handles the windowClosed event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * windowClosed methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    public void windowClosed(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        ((WindowListener)a).windowClosed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        ((WindowListener)b).windowClosed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * Handles the windowIconified event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * windowIconified methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    public void windowIconified(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        ((WindowListener)a).windowIconified(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        ((WindowListener)b).windowIconified(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * Handles the windowDeiconfied event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * windowDeiconified methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    public void windowDeiconified(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        ((WindowListener)a).windowDeiconified(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        ((WindowListener)b).windowDeiconified(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * Handles the windowActivated event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * windowActivated methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    public void windowActivated(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        ((WindowListener)a).windowActivated(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        ((WindowListener)b).windowActivated(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Handles the windowDeactivated event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * windowDeactivated methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    public void windowDeactivated(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        ((WindowListener)a).windowDeactivated(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        ((WindowListener)b).windowDeactivated(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * Handles the windowStateChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * windowStateChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    public void windowStateChanged(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        ((WindowStateListener)a).windowStateChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        ((WindowStateListener)b).windowStateChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * Handles the windowGainedFocus event by invoking the windowGainedFocus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    public void windowGainedFocus(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        ((WindowFocusListener)a).windowGainedFocus(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        ((WindowFocusListener)b).windowGainedFocus(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * Handles the windowLostFocus event by invoking the windowLostFocus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * @param e the window event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    public void windowLostFocus(WindowEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        ((WindowFocusListener)a).windowLostFocus(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        ((WindowFocusListener)b).windowLostFocus(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * Handles the actionPerformed event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * actionPerformed methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * @param e the action event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    public void actionPerformed(ActionEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        ((ActionListener)a).actionPerformed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        ((ActionListener)b).actionPerformed(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * Handles the itemStateChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * itemStateChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    public void itemStateChanged(ItemEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        ((ItemListener)a).itemStateChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        ((ItemListener)b).itemStateChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * Handles the adjustmentValueChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * adjustmentValueChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @param e the adjustment event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    public void adjustmentValueChanged(AdjustmentEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        ((AdjustmentListener)a).adjustmentValueChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        ((AdjustmentListener)b).adjustmentValueChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    public void textValueChanged(TextEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        ((TextListener)a).textValueChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        ((TextListener)b).textValueChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * Handles the inputMethodTextChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * inputMethodTextChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    public void inputMethodTextChanged(InputMethodEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
       ((InputMethodListener)a).inputMethodTextChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
       ((InputMethodListener)b).inputMethodTextChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * Handles the caretPositionChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * caretPositionChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public void caretPositionChanged(InputMethodEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
       ((InputMethodListener)a).caretPositionChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
       ((InputMethodListener)b).caretPositionChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * Handles the hierarchyChanged event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * hierarchyChanged methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    public void hierarchyChanged(HierarchyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        ((HierarchyListener)a).hierarchyChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        ((HierarchyListener)b).hierarchyChanged(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * Handles the ancestorMoved event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * ancestorMoved methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    public void ancestorMoved(HierarchyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        ((HierarchyBoundsListener)a).ancestorMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        ((HierarchyBoundsListener)b).ancestorMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * Handles the ancestorResized event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * ancestorResized methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @param e the item event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    public void ancestorResized(HierarchyEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        ((HierarchyBoundsListener)a).ancestorResized(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        ((HierarchyBoundsListener)b).ancestorResized(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * Handles the mouseWheelMoved event by invoking the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * mouseWheelMoved methods on listener-a and listener-b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * @param e the mouse event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    public void mouseWheelMoved(MouseWheelEvent e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        ((MouseWheelListener)a).mouseWheelMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        ((MouseWheelListener)b).mouseWheelMoved(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * Adds component-listener-a with component-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * @param a component-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * @param b component-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    public static ComponentListener add(ComponentListener a, ComponentListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
        return (ComponentListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * Adds container-listener-a with container-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @param a container-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * @param b container-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    public static ContainerListener add(ContainerListener a, ContainerListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        return (ContainerListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * Adds focus-listener-a with focus-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * @param a focus-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * @param b focus-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    public static FocusListener add(FocusListener a, FocusListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        return (FocusListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * Adds key-listener-a with key-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * @param a key-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * @param b key-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    public static KeyListener add(KeyListener a, KeyListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
        return (KeyListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * Adds mouse-listener-a with mouse-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * @param a mouse-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * @param b mouse-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    public static MouseListener add(MouseListener a, MouseListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
        return (MouseListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     * Adds mouse-motion-listener-a with mouse-motion-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * @param a mouse-motion-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * @param b mouse-motion-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
        return (MouseMotionListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * Adds window-listener-a with window-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * @param a window-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * @param b window-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    public static WindowListener add(WindowListener a, WindowListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
        return (WindowListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * Adds window-state-listener-a with window-state-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * @param a window-state-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * @param b window-state-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    public static WindowStateListener add(WindowStateListener a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                                          WindowStateListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
        return (WindowStateListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * Adds window-focus-listener-a with window-focus-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @param a window-focus-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * @param b window-focus-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    public static WindowFocusListener add(WindowFocusListener a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
                                          WindowFocusListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        return (WindowFocusListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * Adds action-listener-a with action-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * @param a action-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * @param b action-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    public static ActionListener add(ActionListener a, ActionListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        return (ActionListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * Adds item-listener-a with item-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * @param a item-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * @param b item-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    public static ItemListener add(ItemListener a, ItemListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        return (ItemListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * Adds adjustment-listener-a with adjustment-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * @param a adjustment-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * @param b adjustment-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
        return (AdjustmentListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
    public static TextListener add(TextListener a, TextListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
        return (TextListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * Adds input-method-listener-a with input-method-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * @param a input-method-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * @param b input-method-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     public static InputMethodListener add(InputMethodListener a, InputMethodListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
        return (InputMethodListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * Adds hierarchy-listener-a with hierarchy-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * @param a hierarchy-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * @param b hierarchy-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     public static HierarchyListener add(HierarchyListener a, HierarchyListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        return (HierarchyListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     * @param a hierarchy-bounds-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @param b hierarchy-bounds-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        return (HierarchyBoundsListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * Adds mouse-wheel-listener-a with mouse-wheel-listener-b and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     * @param a mouse-wheel-listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * @param b mouse-wheel-listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    public static MouseWheelListener add(MouseWheelListener a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
                                         MouseWheelListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        return (MouseWheelListener)addInternal(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * Removes the old component-listener from component-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * @param l component-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * @param oldl the component-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
    public static ComponentListener remove(ComponentListener l, ComponentListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        return (ComponentListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * Removes the old container-listener from container-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     * @param l container-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     * @param oldl the container-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
    public static ContainerListener remove(ContainerListener l, ContainerListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
        return (ContainerListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * Removes the old focus-listener from focus-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * @param l focus-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * @param oldl the focus-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
    public static FocusListener remove(FocusListener l, FocusListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
        return (FocusListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * Removes the old key-listener from key-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * @param l key-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * @param oldl the key-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
    public static KeyListener remove(KeyListener l, KeyListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
        return (KeyListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * Removes the old mouse-listener from mouse-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * @param l mouse-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * @param oldl the mouse-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
    public static MouseListener remove(MouseListener l, MouseListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
        return (MouseListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * Removes the old mouse-motion-listener from mouse-motion-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * @param l mouse-motion-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * @param oldl the mouse-motion-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
    public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
        return (MouseMotionListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * Removes the old window-listener from window-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     * @param l window-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * @param oldl the window-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    public static WindowListener remove(WindowListener l, WindowListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        return (WindowListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     * Removes the old window-state-listener from window-state-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * @param l window-state-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * @param oldl the window-state-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
    public static WindowStateListener remove(WindowStateListener l,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
                                             WindowStateListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
        return (WindowStateListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * Removes the old window-focus-listener from window-focus-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * @param l window-focus-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     * @param oldl the window-focus-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    public static WindowFocusListener remove(WindowFocusListener l,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
                                             WindowFocusListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        return (WindowFocusListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * Removes the old action-listener from action-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * @param l action-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * @param oldl the action-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
    public static ActionListener remove(ActionListener l, ActionListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
        return (ActionListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * Removes the old item-listener from item-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * @param l item-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * @param oldl the item-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
    public static ItemListener remove(ItemListener l, ItemListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
        return (ItemListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * Removes the old adjustment-listener from adjustment-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     * @param l adjustment-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * @param oldl the adjustment-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
    public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
        return (AdjustmentListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    public static TextListener remove(TextListener l, TextListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
        return (TextListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * Removes the old input-method-listener from input-method-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * @param l input-method-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * @param oldl the input-method-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
    public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
        return (InputMethodListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * Removes the old hierarchy-listener from hierarchy-listener-l and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     * returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * @param l hierarchy-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     * @param oldl the hierarchy-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
    public static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
        return (HierarchyListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     * Removes the old hierarchy-bounds-listener from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * hierarchy-bounds-listener-l and returns the resulting multicast
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     * listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     * @param l hierarchy-bounds-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * @param oldl the hierarchy-bounds-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * @since 1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
    public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
        return (HierarchyBoundsListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * Removes the old mouse-wheel-listener from mouse-wheel-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * and returns the resulting multicast listener.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     * @param l mouse-wheel-listener-l
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * @param oldl the mouse-wheel-listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
    public static MouseWheelListener remove(MouseWheelListener l,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
                                            MouseWheelListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
      return (MouseWheelListener) removeInternal(l, oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * Returns the resulting multicast listener from adding listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * and listener-b together.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     * If listener-a is null, it returns listener-b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     * If listener-b is null, it returns listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     * If neither are null, then it creates and returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
     * a new AWTEventMulticaster instance which chains a with b.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     * @param a event listener-a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * @param b event listener-b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
    protected static EventListener addInternal(EventListener a, EventListener b) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
        if (a == null)  return b;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
        if (b == null)  return a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
        return new AWTEventMulticaster(a, b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * Returns the resulting multicast listener after removing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * old listener from listener-l.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     * If listener-l equals the old listener OR listener-l is null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * returns null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * Else if listener-l is an instance of AWTEventMulticaster,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * then it removes the old listener from it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * Else, returns listener l.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * @param l the listener being removed from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * @param oldl the listener being removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
    protected static EventListener removeInternal(EventListener l, EventListener oldl) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
        if (l == oldl || l == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
        } else if (l instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
            return ((AWTEventMulticaster)l).remove(oldl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
            return l;           // it's not here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
    /* Serialization support.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
    protected void saveInternal(ObjectOutputStream s, String k) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
        if (a instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
            ((AWTEventMulticaster)a).saveInternal(s, k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
        else if (a instanceof Serializable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
            s.writeObject(k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
            s.writeObject(a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
        if (b instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
            ((AWTEventMulticaster)b).saveInternal(s, k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
        else if (b instanceof Serializable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
            s.writeObject(k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
            s.writeObject(b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
    protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
      if (l == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
          return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
      else if (l instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
          ((AWTEventMulticaster)l).saveInternal(s, k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
      else if (l instanceof Serializable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
           s.writeObject(k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
           s.writeObject(l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * Recursive method which returns a count of the number of listeners in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * EventListener, handling the (common) case of l actually being an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * AWTEventMulticaster.  Additionally, only listeners of type listenerType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * are counted.  Method modified to fix bug 4513402.  -bchristi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     */
11270
d7b0b63bd082 7117334: Warnings cleanup day: reduce number of javac warnings in the java.awt package
bagiras
parents: 5506
diff changeset
   956
    private static int getListenerCount(EventListener l, Class<?> listenerType) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
        if (l instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
            AWTEventMulticaster mc = (AWTEventMulticaster)l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
            return getListenerCount(mc.a, listenerType) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
             getListenerCount(mc.b, listenerType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
            // Only count listeners of correct type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
            return listenerType.isInstance(l) ? 1 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * Recusive method which populates EventListener array a with EventListeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * from l.  l is usually an AWTEventMulticaster.  Bug 4513402 revealed that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * if l differed in type from the element type of a, an ArrayStoreException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * would occur.  Now l is only inserted into a if it's of the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * type.  -bchristi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
    private static int populateListenerArray(EventListener[] a, EventListener l, int index) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
        if (l instanceof AWTEventMulticaster) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
            AWTEventMulticaster mc = (AWTEventMulticaster)l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
            int lhs = populateListenerArray(a, mc.a, index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
            return populateListenerArray(a, mc.b, lhs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
        else if (a.getClass().getComponentType().isInstance(l)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
            a[index] = l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
            return index + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
        // Skip nulls, instances of wrong class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
            return index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * Returns an array of all the objects chained as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     * <code><em>Foo</em>Listener</code>s by the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * <code>java.util.EventListener</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * <code><em>Foo</em>Listener</code>s are chained by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * <code>AWTEventMulticaster</code> using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * <code>add<em>Foo</em>Listener</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * If a <code>null</code> listener is specified, this method returns an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * empty array. If the specified listener is not an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * <code>AWTEventMulticaster</code>, this method returns an array which
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 11270
diff changeset
  1001
     * contains only the specified listener. If no such listeners are chained,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * this method returns an empty array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * @param l the specified <code>java.util.EventListener</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * @param listenerType the type of listeners requested; this parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     *          should specify an interface that descends from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     *          <code>java.util.EventListener</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * @return an array of all objects chained as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     *          <code><em>Foo</em>Listener</code>s by the specified multicast
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     *          listener, or an empty array if no such listeners have been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     *          chained by the specified multicast listener
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * @exception NullPointerException if the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     *             {@code listenertype} parameter is {@code null}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * @exception ClassCastException if <code>listenerType</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     *          doesn't specify a class or interface that implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     *          <code>java.util.EventListener</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     */
11270
d7b0b63bd082 7117334: Warnings cleanup day: reduce number of javac warnings in the java.awt package
bagiras
parents: 5506
diff changeset
  1020
    @SuppressWarnings("unchecked")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
    public static <T extends EventListener> T[]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
        getListeners(EventListener l, Class<T> listenerType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
        if (listenerType == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
            throw new NullPointerException ("Listener type should not be null");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
        int n = getListenerCount(l, listenerType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
        T[] result = (T[])Array.newInstance(listenerType, n);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
        populateListenerArray(result, l, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
}