- All Implemented Interfaces:
ActionListener
,AdjustmentListener
,ComponentListener
,ContainerListener
,FocusListener
,HierarchyBoundsListener
,HierarchyListener
,InputMethodListener
,ItemListener
,KeyListener
,MouseListener
,MouseMotionListener
,MouseWheelListener
,TextListener
,WindowFocusListener
,WindowListener
,WindowStateListener
,EventListener
AWTEventMulticaster
implements efficient and thread-safe multi-cast
event dispatching for the AWT events defined in the java.awt.event
package.
The following example illustrates how to use this class:
public myComponent extends Component {
ActionListener actionListener = null;
public synchronized void addActionListener(ActionListener l) {
actionListener = AWTEventMulticaster.add(actionListener, l);
}
public synchronized void removeActionListener(ActionListener l) {
actionListener = AWTEventMulticaster.remove(actionListener, l);
}
public void processEvent(AWTEvent e) {
// when event occurs which causes "action" semantic
ActionListener listener = actionListener;
if (listener != null) {
listener.actionPerformed(new ActionEvent());
}
}
}
The important point to note is the first argument to the
add
and remove
methods is the field maintaining the
listeners. In addition you must assign the result of the add
and remove
methods to the field maintaining the listeners.
AWTEventMulticaster
is implemented as a pair of
EventListeners
that are set at construction time.
AWTEventMulticaster
is immutable. The add
and
remove
methods do not alter AWTEventMulticaster
in
anyway. If necessary, a new AWTEventMulticaster
is
created. In this way it is safe to add and remove listeners during
the process of an event dispatching. However, event listeners
added during the process of an event dispatch operation are not
notified of the event currently being dispatched.
All of the add
methods allow null
arguments. If the
first argument is null
, the second argument is returned. If
the first argument is not null
and the second argument is
null
, the first argument is returned. If both arguments are
non-null
, a new AWTEventMulticaster
is created using
the two arguments and returned.
For the remove
methods that take two arguments, the following is
returned:
null
, if the first argument isnull
, or the arguments are equal, by way of==
.- the first argument, if the first argument is not an instance of
AWTEventMulticaster
. - result of invoking
remove(EventListener)
on the first argument, supplying the second argument to theremove(EventListener)
method.
Swing makes use of
EventListenerList
for
similar logic. Refer to it for details.
- Since:
- 1.1
- See Also:
EventListenerList
-
Field Summary
Modifier and TypeFieldDescriptionprotected EventListener
A variable in the event chain (listener-a)protected EventListener
A variable in the event chain (listener-b) -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates an event multicaster instance which chains listener-a with listener-b. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.static ActionListener
add(ActionListener a, ActionListener b)
Adds action-listener-a with action-listener-b and returns the resulting multicast listener.static AdjustmentListener
Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.static ComponentListener
Adds component-listener-a with component-listener-b and returns the resulting multicast listener.static ContainerListener
Adds container-listener-a with container-listener-b and returns the resulting multicast listener.static FocusListener
add(FocusListener a, FocusListener b)
Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.static HierarchyBoundsListener
Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and returns the resulting multicast listener.static HierarchyListener
Adds hierarchy-listener-a with hierarchy-listener-b and returns the resulting multicast listener.static InputMethodListener
Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener.static ItemListener
add(ItemListener a, ItemListener b)
Adds item-listener-a with item-listener-b and returns the resulting multicast listener.static KeyListener
add(KeyListener a, KeyListener b)
Adds key-listener-a with key-listener-b and returns the resulting multicast listener.static MouseListener
add(MouseListener a, MouseListener b)
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.static MouseMotionListener
Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener.static MouseWheelListener
Adds mouse-wheel-listener-a with mouse-wheel-listener-b and returns the resulting multicast listener.static TextListener
add(TextListener a, TextListener b)
Adds text-listener-a with text-listener-b and returns the resulting multicast listener.static WindowFocusListener
Adds window-focus-listener-a with window-focus-listener-b and returns the resulting multicast listener.static WindowListener
add(WindowListener a, WindowListener b)
Adds window-listener-a with window-listener-b and returns the resulting multicast listener.static WindowStateListener
Adds window-state-listener-a with window-state-listener-b and returns the resulting multicast listener.protected static EventListener
Returns the resulting multicast listener from adding listener-a and listener-b together.void
Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.void
Handles the ancestorMoved event by invoking the ancestorMoved methods on listener-a and listener-b.void
Handles the ancestorResized event by invoking the ancestorResized methods on listener-a and listener-b.void
Handles the caretPositionChanged event by invoking the caretPositionChanged methods on listener-a and listener-b.void
Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.void
Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.void
Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.void
Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.void
Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.void
Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.void
Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.void
focusLost(FocusEvent e)
Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b.static <T extends EventListener>
T[]getListeners(EventListener l, Class<T> listenerType)
Returns an array of all the objects chained asFooListener
s by the specifiedjava.util.EventListener
.void
Handles the hierarchyChanged event by invoking the hierarchyChanged methods on listener-a and listener-b.void
Handles the inputMethodTextChanged event by invoking the inputMethodTextChanged methods on listener-a and listener-b.void
Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.void
keyPressed(KeyEvent e)
Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.void
keyReleased(KeyEvent e)
Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.void
Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.void
Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.void
Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.void
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.void
Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.void
mouseMoved(MouseEvent e)
Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.void
Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.void
Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.void
Handles the mouseWheelMoved event by invoking the mouseWheelMoved methods on listener-a and listener-b.static ActionListener
remove(ActionListener l, ActionListener oldl)
Removes the old action-listener from action-listener-l and returns the resulting multicast listener.static AdjustmentListener
remove(AdjustmentListener l, AdjustmentListener oldl)
Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener.static ComponentListener
remove(ComponentListener l, ComponentListener oldl)
Removes the old component-listener from component-listener-l and returns the resulting multicast listener.static ContainerListener
remove(ContainerListener l, ContainerListener oldl)
Removes the old container-listener from container-listener-l and returns the resulting multicast listener.static FocusListener
remove(FocusListener l, FocusListener oldl)
Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener.static HierarchyBoundsListener
Removes the old hierarchy-bounds-listener from hierarchy-bounds-listener-l and returns the resulting multicast listener.static HierarchyListener
remove(HierarchyListener l, HierarchyListener oldl)
Removes the old hierarchy-listener from hierarchy-listener-l and returns the resulting multicast listener.static InputMethodListener
remove(InputMethodListener l, InputMethodListener oldl)
Removes the old input-method-listener from input-method-listener-l and returns the resulting multicast listener.static ItemListener
remove(ItemListener l, ItemListener oldl)
Removes the old item-listener from item-listener-l and returns the resulting multicast listener.static KeyListener
remove(KeyListener l, KeyListener oldl)
Removes the old key-listener from key-listener-l and returns the resulting multicast listener.static MouseListener
remove(MouseListener l, MouseListener oldl)
Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.static MouseMotionListener
remove(MouseMotionListener l, MouseMotionListener oldl)
Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener.static MouseWheelListener
remove(MouseWheelListener l, MouseWheelListener oldl)
Removes the old mouse-wheel-listener from mouse-wheel-listener-l and returns the resulting multicast listener.static TextListener
remove(TextListener l, TextListener oldl)
Removes the old text-listener from text-listener-l and returns the resulting multicast listener.static WindowFocusListener
remove(WindowFocusListener l, WindowFocusListener oldl)
Removes the old window-focus-listener from window-focus-listener-l and returns the resulting multicast listener.static WindowListener
remove(WindowListener l, WindowListener oldl)
Removes the old window-listener from window-listener-l and returns the resulting multicast listener.static WindowStateListener
remove(WindowStateListener l, WindowStateListener oldl)
Removes the old window-state-listener from window-state-listener-l and returns the resulting multicast listener.protected EventListener
remove(EventListener oldl)
Removes a listener from this multicaster.protected static EventListener
removeInternal(EventListener l, EventListener oldl)
Returns the resulting multicast listener after removing the old listener from listener-l.protected static void
save(ObjectOutputStream s, String k, EventListener l)
Saves a Serializable listener chain to a serialization stream.protected void
saveInternal(ObjectOutputStream s, String k)
Serialization support.void
Invoked when the value of the text has changed.void
Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.void
Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.void
Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.void
Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.void
Handles the windowDeiconified event by invoking the windowDeiconified methods on listener-a and listener-b.void
Handles the windowGainedFocus event by invoking the windowGainedFocus methods on listener-a and listener-b.void
Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.void
Handles the windowLostFocus event by invoking the windowLostFocus methods on listener-a and listener-b.void
Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.void
Handles the windowStateChanged event by invoking the windowStateChanged methods on listener-a and listener-b.
-
Field Details
-
a
A variable in the event chain (listener-a) -
b
A variable in the event chain (listener-b)
-
-
Constructor Details
-
AWTEventMulticaster
Creates an event multicaster instance which chains listener-a with listener-b. Input parametersa
andb
should not benull
, though implementations may vary in choosing whether or not to throwNullPointerException
in that case.- Parameters:
a
- listener-ab
- listener-b
-
-
Method Details
-
remove
Removes a listener from this multicaster.The returned multicaster contains all the listeners in this multicaster with the exception of all occurrences of
oldl
. If the resulting multicaster contains only one regular listener the regular listener may be returned. If the resulting multicaster is empty, thennull
may be returned instead.No exception is thrown if
oldl
isnull
.- Parameters:
oldl
- the listener to be removed- Returns:
- resulting listener
-
componentResized
Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.- Specified by:
componentResized
in interfaceComponentListener
- Parameters:
e
- the component event
-
componentMoved
Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.- Specified by:
componentMoved
in interfaceComponentListener
- Parameters:
e
- the component event
-
componentShown
Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.- Specified by:
componentShown
in interfaceComponentListener
- Parameters:
e
- the component event
-
componentHidden
Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.- Specified by:
componentHidden
in interfaceComponentListener
- Parameters:
e
- the component event
-
componentAdded
Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.- Specified by:
componentAdded
in interfaceContainerListener
- Parameters:
e
- the component event
-
componentRemoved
Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.- Specified by:
componentRemoved
in interfaceContainerListener
- Parameters:
e
- the component event
-
focusGained
Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.- Specified by:
focusGained
in interfaceFocusListener
- Parameters:
e
- the focus event
-
focusLost
Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b.- Specified by:
focusLost
in interfaceFocusListener
- Parameters:
e
- the focus event
-
keyTyped
Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.- Specified by:
keyTyped
in interfaceKeyListener
- Parameters:
e
- the key event
-
keyPressed
Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
e
- the key event
-
keyReleased
Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
e
- the key event
-
mouseClicked
Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
e
- the mouse event
-
mousePressed
Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
e
- the mouse event
-
mouseReleased
Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
e
- the mouse event
-
mouseEntered
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.- Specified by:
mouseEntered
in interfaceMouseListener
- Parameters:
e
- the mouse event
-
mouseExited
Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.- Specified by:
mouseExited
in interfaceMouseListener
- Parameters:
e
- the mouse event
-
mouseDragged
Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.- Specified by:
mouseDragged
in interfaceMouseMotionListener
- Parameters:
e
- the mouse event
-
mouseMoved
Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.- Specified by:
mouseMoved
in interfaceMouseMotionListener
- Parameters:
e
- the mouse event
-
windowOpened
Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.- Specified by:
windowOpened
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowClosing
Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.- Specified by:
windowClosing
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowClosed
Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.- Specified by:
windowClosed
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowIconified
Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.- Specified by:
windowIconified
in interfaceWindowListener
- Parameters:
e
- the window event- See Also:
Window.setIconImage(java.awt.Image)
-
windowDeiconified
Handles the windowDeiconified event by invoking the windowDeiconified methods on listener-a and listener-b.- Specified by:
windowDeiconified
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowActivated
Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.- Specified by:
windowActivated
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowDeactivated
Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.- Specified by:
windowDeactivated
in interfaceWindowListener
- Parameters:
e
- the window event
-
windowStateChanged
Handles the windowStateChanged event by invoking the windowStateChanged methods on listener-a and listener-b.- Specified by:
windowStateChanged
in interfaceWindowStateListener
- Parameters:
e
- the window event- Since:
- 1.4
-
windowGainedFocus
Handles the windowGainedFocus event by invoking the windowGainedFocus methods on listener-a and listener-b.- Specified by:
windowGainedFocus
in interfaceWindowFocusListener
- Parameters:
e
- the window event- Since:
- 1.4
-
windowLostFocus
Handles the windowLostFocus event by invoking the windowLostFocus methods on listener-a and listener-b.- Specified by:
windowLostFocus
in interfaceWindowFocusListener
- Parameters:
e
- the window event- Since:
- 1.4
-
actionPerformed
Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
e
- the action event
-
itemStateChanged
Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.- Specified by:
itemStateChanged
in interfaceItemListener
- Parameters:
e
- the item event
-
adjustmentValueChanged
Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.- Specified by:
adjustmentValueChanged
in interfaceAdjustmentListener
- Parameters:
e
- the adjustment event
-
textValueChanged
Description copied from interface:TextListener
Invoked when the value of the text has changed. The code written for this method performs the operations that need to occur when text changes.- Specified by:
textValueChanged
in interfaceTextListener
- Parameters:
e
- the event to be processed
-
inputMethodTextChanged
Handles the inputMethodTextChanged event by invoking the inputMethodTextChanged methods on listener-a and listener-b.- Specified by:
inputMethodTextChanged
in interfaceInputMethodListener
- Parameters:
e
- the item event
-
caretPositionChanged
Handles the caretPositionChanged event by invoking the caretPositionChanged methods on listener-a and listener-b.- Specified by:
caretPositionChanged
in interfaceInputMethodListener
- Parameters:
e
- the item event
-
hierarchyChanged
Handles the hierarchyChanged event by invoking the hierarchyChanged methods on listener-a and listener-b.- Specified by:
hierarchyChanged
in interfaceHierarchyListener
- Parameters:
e
- the item event- Since:
- 1.3
- See Also:
HierarchyEvent.getChangeFlags()
-
ancestorMoved
Handles the ancestorMoved event by invoking the ancestorMoved methods on listener-a and listener-b.- Specified by:
ancestorMoved
in interfaceHierarchyBoundsListener
- Parameters:
e
- the item event- Since:
- 1.3
-
ancestorResized
Handles the ancestorResized event by invoking the ancestorResized methods on listener-a and listener-b.- Specified by:
ancestorResized
in interfaceHierarchyBoundsListener
- Parameters:
e
- the item event- Since:
- 1.3
-
mouseWheelMoved
Handles the mouseWheelMoved event by invoking the mouseWheelMoved methods on listener-a and listener-b.- Specified by:
mouseWheelMoved
in interfaceMouseWheelListener
- Parameters:
e
- the mouse event- Since:
- 1.4
- See Also:
MouseWheelEvent
-
add
Adds component-listener-a with component-listener-b and returns the resulting multicast listener.- Parameters:
a
- component-listener-ab
- component-listener-b- Returns:
- the resulting listener
-
add
Adds container-listener-a with container-listener-b and returns the resulting multicast listener.- Parameters:
a
- container-listener-ab
- container-listener-b- Returns:
- the resulting listener
-
add
Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.- Parameters:
a
- focus-listener-ab
- focus-listener-b- Returns:
- the resulting listener
-
add
Adds key-listener-a with key-listener-b and returns the resulting multicast listener.- Parameters:
a
- key-listener-ab
- key-listener-b- Returns:
- the resulting listener
-
add
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.- Parameters:
a
- mouse-listener-ab
- mouse-listener-b- Returns:
- the resulting listener
-
add
Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener.- Parameters:
a
- mouse-motion-listener-ab
- mouse-motion-listener-b- Returns:
- the resulting listener
-
add
Adds window-listener-a with window-listener-b and returns the resulting multicast listener.- Parameters:
a
- window-listener-ab
- window-listener-b- Returns:
- the resulting listener
-
add
Adds window-state-listener-a with window-state-listener-b and returns the resulting multicast listener.- Parameters:
a
- window-state-listener-ab
- window-state-listener-b- Returns:
- the resulting listener
- Since:
- 1.4
-
add
Adds window-focus-listener-a with window-focus-listener-b and returns the resulting multicast listener.- Parameters:
a
- window-focus-listener-ab
- window-focus-listener-b- Returns:
- the resulting listener
- Since:
- 1.4
-
add
Adds action-listener-a with action-listener-b and returns the resulting multicast listener.- Parameters:
a
- action-listener-ab
- action-listener-b- Returns:
- the resulting listener
-
add
Adds item-listener-a with item-listener-b and returns the resulting multicast listener.- Parameters:
a
- item-listener-ab
- item-listener-b- Returns:
- the resulting listener
-
add
Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.- Parameters:
a
- adjustment-listener-ab
- adjustment-listener-b- Returns:
- the resulting listener
-
add
Adds text-listener-a with text-listener-b and returns the resulting multicast listener.- Parameters:
a
- text-listener-ab
- text-listener-b- Returns:
- the resulting listener
-
add
Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener.- Parameters:
a
- input-method-listener-ab
- input-method-listener-b- Returns:
- the resulting listener
-
add
Adds hierarchy-listener-a with hierarchy-listener-b and returns the resulting multicast listener.- Parameters:
a
- hierarchy-listener-ab
- hierarchy-listener-b- Returns:
- the resulting listener
- Since:
- 1.3
-
add
Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and returns the resulting multicast listener.- Parameters:
a
- hierarchy-bounds-listener-ab
- hierarchy-bounds-listener-b- Returns:
- the resulting listener
- Since:
- 1.3
-
add
Adds mouse-wheel-listener-a with mouse-wheel-listener-b and returns the resulting multicast listener.- Parameters:
a
- mouse-wheel-listener-ab
- mouse-wheel-listener-b- Returns:
- the resulting listener
- Since:
- 1.4
-
remove
Removes the old component-listener from component-listener-l and returns the resulting multicast listener.- Parameters:
l
- component-listener-loldl
- the component-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old container-listener from container-listener-l and returns the resulting multicast listener.- Parameters:
l
- container-listener-loldl
- the container-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener.- Parameters:
l
- focus-listener-loldl
- the focus-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old key-listener from key-listener-l and returns the resulting multicast listener.- Parameters:
l
- key-listener-loldl
- the key-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.- Parameters:
l
- mouse-listener-loldl
- the mouse-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener.- Parameters:
l
- mouse-motion-listener-loldl
- the mouse-motion-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old window-listener from window-listener-l and returns the resulting multicast listener.- Parameters:
l
- window-listener-loldl
- the window-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old window-state-listener from window-state-listener-l and returns the resulting multicast listener.- Parameters:
l
- window-state-listener-loldl
- the window-state-listener being removed- Returns:
- the resulting listener
- Since:
- 1.4
-
remove
Removes the old window-focus-listener from window-focus-listener-l and returns the resulting multicast listener.- Parameters:
l
- window-focus-listener-loldl
- the window-focus-listener being removed- Returns:
- the resulting listener
- Since:
- 1.4
-
remove
Removes the old action-listener from action-listener-l and returns the resulting multicast listener.- Parameters:
l
- action-listener-loldl
- the action-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old item-listener from item-listener-l and returns the resulting multicast listener.- Parameters:
l
- item-listener-loldl
- the item-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener.- Parameters:
l
- adjustment-listener-loldl
- the adjustment-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old text-listener from text-listener-l and returns the resulting multicast listener.- Parameters:
l
- text-listener-loldl
- the text-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old input-method-listener from input-method-listener-l and returns the resulting multicast listener.- Parameters:
l
- input-method-listener-loldl
- the input-method-listener being removed- Returns:
- the resulting listener
-
remove
Removes the old hierarchy-listener from hierarchy-listener-l and returns the resulting multicast listener.- Parameters:
l
- hierarchy-listener-loldl
- the hierarchy-listener being removed- Returns:
- the resulting listener
- Since:
- 1.3
-
remove
public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl)Removes the old hierarchy-bounds-listener from hierarchy-bounds-listener-l and returns the resulting multicast listener.- Parameters:
l
- hierarchy-bounds-listener-loldl
- the hierarchy-bounds-listener being removed- Returns:
- the resulting listener
- Since:
- 1.3
-
remove
Removes the old mouse-wheel-listener from mouse-wheel-listener-l and returns the resulting multicast listener.- Parameters:
l
- mouse-wheel-listener-loldl
- the mouse-wheel-listener being removed- Returns:
- the resulting listener
- Since:
- 1.4
-
addInternal
Returns the resulting multicast listener from adding listener-a and listener-b together. If listener-a is null, it returns listener-b; If listener-b is null, it returns listener-a If neither are null, then it creates and returns a new AWTEventMulticaster instance which chains a with b.- Parameters:
a
- event listener-ab
- event listener-b- Returns:
- the resulting listener
-
removeInternal
Returns the resulting multicast listener after removing the old listener from listener-l. If listener-l equals the old listener OR listener-l is null, returns null. Else if listener-l is an instance of AWTEventMulticaster, then it removes the old listener from it. Else, returns listener l.- Parameters:
l
- the listener being removed fromoldl
- the listener being removed- Returns:
- the resulting listener
-
saveInternal
Serialization support. Saves all Serializable listeners to a serialization stream.- Parameters:
s
- the stream to save tok
- a prefix stream to put before each serializable listener- Throws:
IOException
- if serialization fails
-
save
Saves a Serializable listener chain to a serialization stream.- Parameters:
s
- the stream to save tok
- a prefix stream to put before each serializable listenerl
- the listener chain to save- Throws:
IOException
- if serialization fails
-
getListeners
Returns an array of all the objects chained asFooListener
s by the specifiedjava.util.EventListener
.FooListener
s are chained by theAWTEventMulticaster
using theaddFooListener
method. If anull
listener is specified, this method returns an empty array. If the specified listener is not an instance ofAWTEventMulticaster
, this method returns an array which contains only the specified listener. If no such listeners are chained, this method returns an empty array.- Type Parameters:
T
- the listener type- Parameters:
l
- the specifiedjava.util.EventListener
listenerType
- the type of listeners requested; this parameter should specify an interface that descends fromjava.util.EventListener
- Returns:
- an array of all objects chained as
FooListener
s by the specified multicast listener, or an empty array if no such listeners have been chained by the specified multicast listener - Throws:
NullPointerException
- if the specifiedlistenertype
parameter isnull
ClassCastException
- iflistenerType
doesn't specify a class or interface that implementsjava.util.EventListener
- Since:
- 1.4
-