- java.lang.Object
-
- java.awt.AWTEventMulticaster
-
- All Implemented Interfaces:
- ActionListener, AdjustmentListener, ComponentListener, ContainerListener, FocusListener, HierarchyBoundsListener, HierarchyListener, InputMethodListener, ItemListener, KeyListener, MouseListener, MouseMotionListener, MouseWheelListener, TextListener, WindowFocusListener, WindowListener, WindowStateListener, EventListener
public class AWTEventMulticaster extends Object implements ComponentListener, ContainerListener, FocusListener, KeyListener, MouseListener, MouseMotionListener, WindowListener, WindowFocusListener, WindowStateListener, ActionListener, ItemListener, AdjustmentListener, TextListener, InputMethodListener, HierarchyListener, HierarchyBoundsListener, MouseWheelListener
AWTEventMulticasterimplements efficient and thread-safe multi-cast event dispatching for the AWT events defined in thejava.awt.eventpackage.The following example illustrates how to use this class:
The important point to note is the first argument to thepublic 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()); } } }addandremovemethods is the field maintaining the listeners. In addition you must assign the result of theaddandremovemethods to the field maintaining the listeners.AWTEventMulticasteris implemented as a pair ofEventListenersthat are set at construction time.AWTEventMulticasteris immutable. Theaddandremovemethods do not alterAWTEventMulticasterin anyway. If necessary, a newAWTEventMulticasteris 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
addmethods allownullarguments. If the first argument isnull, the second argument is returned. If the first argument is notnulland the second argument isnull, the first argument is returned. If both arguments arenon-null, a newAWTEventMulticasteris created using the two arguments and returned.For the
removemethods 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
EventListenerListfor similar logic. Refer to it for details.- Since:
- 1.1
- See Also:
EventListenerList
-
-
Field Summary
Fields Modifier and Type Field and Description protected EventListeneraprotected EventListenerb
-
Constructor Summary
Constructors Modifier Constructor and Description protectedAWTEventMulticaster(EventListener a, EventListener b)Creates an event multicaster instance which chains listener-a with listener-b.
-
Method Summary
Methods Modifier and Type Method and Description voidactionPerformed(ActionEvent e)Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.static ActionListeneradd(ActionListener a, ActionListener b)Adds action-listener-a with action-listener-b and returns the resulting multicast listener.static AdjustmentListeneradd(AdjustmentListener a, AdjustmentListener b)Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.static ComponentListeneradd(ComponentListener a, ComponentListener b)Adds component-listener-a with component-listener-b and returns the resulting multicast listener.static ContainerListeneradd(ContainerListener a, ContainerListener b)Adds container-listener-a with container-listener-b and returns the resulting multicast listener.static FocusListeneradd(FocusListener a, FocusListener b)Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.static HierarchyBoundsListeneradd(HierarchyBoundsListener a, HierarchyBoundsListener b)Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and returns the resulting multicast listener.static HierarchyListeneradd(HierarchyListener a, HierarchyListener b)Adds hierarchy-listener-a with hierarchy-listener-b and returns the resulting multicast listener.static InputMethodListeneradd(InputMethodListener a, InputMethodListener b)Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener.static ItemListeneradd(ItemListener a, ItemListener b)Adds item-listener-a with item-listener-b and returns the resulting multicast listener.static KeyListeneradd(KeyListener a, KeyListener b)Adds key-listener-a with key-listener-b and returns the resulting multicast listener.static MouseListeneradd(MouseListener a, MouseListener b)Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.static MouseMotionListeneradd(MouseMotionListener a, MouseMotionListener b)Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener.static MouseWheelListeneradd(MouseWheelListener a, MouseWheelListener b)Adds mouse-wheel-listener-a with mouse-wheel-listener-b and returns the resulting multicast listener.static TextListeneradd(TextListener a, TextListener b)static WindowFocusListeneradd(WindowFocusListener a, WindowFocusListener b)Adds window-focus-listener-a with window-focus-listener-b and returns the resulting multicast listener.static WindowListeneradd(WindowListener a, WindowListener b)Adds window-listener-a with window-listener-b and returns the resulting multicast listener.static WindowStateListeneradd(WindowStateListener a, WindowStateListener b)Adds window-state-listener-a with window-state-listener-b and returns the resulting multicast listener.protected static EventListeneraddInternal(EventListener a, EventListener b)Returns the resulting multicast listener from adding listener-a and listener-b together.voidadjustmentValueChanged(AdjustmentEvent e)Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.voidancestorMoved(HierarchyEvent e)Handles the ancestorMoved event by invoking the ancestorMoved methods on listener-a and listener-b.voidancestorResized(HierarchyEvent e)Handles the ancestorResized event by invoking the ancestorResized methods on listener-a and listener-b.voidcaretPositionChanged(InputMethodEvent e)Handles the caretPositionChanged event by invoking the caretPositionChanged methods on listener-a and listener-b.voidcomponentAdded(ContainerEvent e)Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.voidcomponentHidden(ComponentEvent e)Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.voidcomponentMoved(ComponentEvent e)Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.voidcomponentRemoved(ContainerEvent e)Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.voidcomponentResized(ComponentEvent e)Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.voidcomponentShown(ComponentEvent e)Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.voidfocusGained(FocusEvent e)Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.voidfocusLost(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 asFooListeners by the specifiedjava.util.EventListener.voidhierarchyChanged(HierarchyEvent e)Handles the hierarchyChanged event by invoking the hierarchyChanged methods on listener-a and listener-b.voidinputMethodTextChanged(InputMethodEvent e)Handles the inputMethodTextChanged event by invoking the inputMethodTextChanged methods on listener-a and listener-b.voiditemStateChanged(ItemEvent e)Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.voidkeyPressed(KeyEvent e)Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.voidkeyReleased(KeyEvent e)Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.voidkeyTyped(KeyEvent e)Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.voidmouseClicked(MouseEvent e)Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.voidmouseDragged(MouseEvent e)Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.voidmouseEntered(MouseEvent e)Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.voidmouseExited(MouseEvent e)Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.voidmouseMoved(MouseEvent e)Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.voidmousePressed(MouseEvent e)Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.voidmouseReleased(MouseEvent e)Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.voidmouseWheelMoved(MouseWheelEvent e)Handles the mouseWheelMoved event by invoking the mouseWheelMoved methods on listener-a and listener-b.static ActionListenerremove(ActionListener l, ActionListener oldl)Removes the old action-listener from action-listener-l and returns the resulting multicast listener.static AdjustmentListenerremove(AdjustmentListener l, AdjustmentListener oldl)Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener.static ComponentListenerremove(ComponentListener l, ComponentListener oldl)Removes the old component-listener from component-listener-l and returns the resulting multicast listener.static ContainerListenerremove(ContainerListener l, ContainerListener oldl)Removes the old container-listener from container-listener-l and returns the resulting multicast listener.protected EventListenerremove(EventListener oldl)Removes a listener from this multicaster.static FocusListenerremove(FocusListener l, FocusListener oldl)Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener.static HierarchyBoundsListenerremove(HierarchyBoundsListener l, HierarchyBoundsListener oldl)Removes the old hierarchy-bounds-listener from hierarchy-bounds-listener-l and returns the resulting multicast listener.static HierarchyListenerremove(HierarchyListener l, HierarchyListener oldl)Removes the old hierarchy-listener from hierarchy-listener-l and returns the resulting multicast listener.static InputMethodListenerremove(InputMethodListener l, InputMethodListener oldl)Removes the old input-method-listener from input-method-listener-l and returns the resulting multicast listener.static ItemListenerremove(ItemListener l, ItemListener oldl)Removes the old item-listener from item-listener-l and returns the resulting multicast listener.static KeyListenerremove(KeyListener l, KeyListener oldl)Removes the old key-listener from key-listener-l and returns the resulting multicast listener.static MouseListenerremove(MouseListener l, MouseListener oldl)Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener.static MouseMotionListenerremove(MouseMotionListener l, MouseMotionListener oldl)Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener.static MouseWheelListenerremove(MouseWheelListener l, MouseWheelListener oldl)Removes the old mouse-wheel-listener from mouse-wheel-listener-l and returns the resulting multicast listener.static TextListenerremove(TextListener l, TextListener oldl)static WindowFocusListenerremove(WindowFocusListener l, WindowFocusListener oldl)Removes the old window-focus-listener from window-focus-listener-l and returns the resulting multicast listener.static WindowListenerremove(WindowListener l, WindowListener oldl)Removes the old window-listener from window-listener-l and returns the resulting multicast listener.static WindowStateListenerremove(WindowStateListener l, WindowStateListener oldl)Removes the old window-state-listener from window-state-listener-l and returns the resulting multicast listener.protected static EventListenerremoveInternal(EventListener l, EventListener oldl)Returns the resulting multicast listener after removing the old listener from listener-l.protected static voidsave(ObjectOutputStream s, String k, EventListener l)protected voidsaveInternal(ObjectOutputStream s, String k)voidtextValueChanged(TextEvent e)Invoked when the value of the text has changed.voidwindowActivated(WindowEvent e)Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.voidwindowClosed(WindowEvent e)Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.voidwindowClosing(WindowEvent e)Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.voidwindowDeactivated(WindowEvent e)Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.voidwindowDeiconified(WindowEvent e)Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and listener-b.voidwindowGainedFocus(WindowEvent e)Handles the windowGainedFocus event by invoking the windowGainedFocus methods on listener-a and listener-b.voidwindowIconified(WindowEvent e)Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.voidwindowLostFocus(WindowEvent e)Handles the windowLostFocus event by invoking the windowLostFocus methods on listener-a and listener-b.voidwindowOpened(WindowEvent e)Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.voidwindowStateChanged(WindowEvent e)Handles the windowStateChanged event by invoking the windowStateChanged methods on listener-a and listener-b.
-
-
-
Field Detail
-
a
protected final EventListener a
-
b
protected final EventListener b
-
-
Constructor Detail
-
AWTEventMulticaster
protected AWTEventMulticaster(EventListener a, EventListener b)
Creates an event multicaster instance which chains listener-a with listener-b. Input parametersaandbshould not benull, though implementations may vary in choosing whether or not to throwNullPointerExceptionin that case.- Parameters:
a- listener-ab- listener-b
-
-
Method Detail
-
remove
protected EventListener remove(EventListener oldl)
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, thennullmay be returned instead.No exception is thrown if
oldlisnull.- Parameters:
oldl- the listener to be removed- Returns:
- resulting listener
-
componentResized
public void componentResized(ComponentEvent e)
Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b.- Specified by:
componentResizedin interfaceComponentListener- Parameters:
e- the component event
-
componentMoved
public void componentMoved(ComponentEvent e)
Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b.- Specified by:
componentMovedin interfaceComponentListener- Parameters:
e- the component event
-
componentShown
public void componentShown(ComponentEvent e)
Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b.- Specified by:
componentShownin interfaceComponentListener- Parameters:
e- the component event
-
componentHidden
public void componentHidden(ComponentEvent e)
Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b.- Specified by:
componentHiddenin interfaceComponentListener- Parameters:
e- the component event
-
componentAdded
public void componentAdded(ContainerEvent e)
Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b.- Specified by:
componentAddedin interfaceContainerListener- Parameters:
e- the component event
-
componentRemoved
public void componentRemoved(ContainerEvent e)
Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b.- Specified by:
componentRemovedin interfaceContainerListener- Parameters:
e- the component event
-
focusGained
public void focusGained(FocusEvent e)
Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b.- Specified by:
focusGainedin interfaceFocusListener- Parameters:
e- the focus event
-
focusLost
public void focusLost(FocusEvent e)
Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b.- Specified by:
focusLostin interfaceFocusListener- Parameters:
e- the focus event
-
keyTyped
public void keyTyped(KeyEvent e)
Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b.- Specified by:
keyTypedin interfaceKeyListener- Parameters:
e- the key event
-
keyPressed
public void keyPressed(KeyEvent e)
Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b.- Specified by:
keyPressedin interfaceKeyListener- Parameters:
e- the key event
-
keyReleased
public void keyReleased(KeyEvent e)
Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b.- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- the key event
-
mouseClicked
public void mouseClicked(MouseEvent e)
Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b.- Specified by:
mouseClickedin interfaceMouseListener- Parameters:
e- the mouse event
-
mousePressed
public void mousePressed(MouseEvent e)
Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b.- Specified by:
mousePressedin interfaceMouseListener- Parameters:
e- the mouse event
-
mouseReleased
public void mouseReleased(MouseEvent e)
Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b.- Specified by:
mouseReleasedin interfaceMouseListener- Parameters:
e- the mouse event
-
mouseEntered
public void mouseEntered(MouseEvent e)
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b.- Specified by:
mouseEnteredin interfaceMouseListener- Parameters:
e- the mouse event
-
mouseExited
public void mouseExited(MouseEvent e)
Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b.- Specified by:
mouseExitedin interfaceMouseListener- Parameters:
e- the mouse event
-
mouseDragged
public void mouseDragged(MouseEvent e)
Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b.- Specified by:
mouseDraggedin interfaceMouseMotionListener- Parameters:
e- the mouse event
-
mouseMoved
public void mouseMoved(MouseEvent e)
Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b.- Specified by:
mouseMovedin interfaceMouseMotionListener- Parameters:
e- the mouse event
-
windowOpened
public void windowOpened(WindowEvent e)
Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b.- Specified by:
windowOpenedin interfaceWindowListener- Parameters:
e- the window event
-
windowClosing
public void windowClosing(WindowEvent e)
Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b.- Specified by:
windowClosingin interfaceWindowListener- Parameters:
e- the window event
-
windowClosed
public void windowClosed(WindowEvent e)
Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b.- Specified by:
windowClosedin interfaceWindowListener- Parameters:
e- the window event
-
windowIconified
public void windowIconified(WindowEvent e)
Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b.- Specified by:
windowIconifiedin interfaceWindowListener- Parameters:
e- the window event- See Also:
Frame.setIconImage(java.awt.Image)
-
windowDeiconified
public void windowDeiconified(WindowEvent e)
Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and listener-b.- Specified by:
windowDeiconifiedin interfaceWindowListener- Parameters:
e- the window event
-
windowActivated
public void windowActivated(WindowEvent e)
Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b.- Specified by:
windowActivatedin interfaceWindowListener- Parameters:
e- the window event
-
windowDeactivated
public void windowDeactivated(WindowEvent e)
Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b.- Specified by:
windowDeactivatedin interfaceWindowListener- Parameters:
e- the window event
-
windowStateChanged
public void windowStateChanged(WindowEvent e)
Handles the windowStateChanged event by invoking the windowStateChanged methods on listener-a and listener-b.- Specified by:
windowStateChangedin interfaceWindowStateListener- Parameters:
e- the window event- Since:
- 1.4
-
windowGainedFocus
public void windowGainedFocus(WindowEvent e)
Handles the windowGainedFocus event by invoking the windowGainedFocus methods on listener-a and listener-b.- Specified by:
windowGainedFocusin interfaceWindowFocusListener- Parameters:
e- the window event- Since:
- 1.4
-
windowLostFocus
public void windowLostFocus(WindowEvent e)
Handles the windowLostFocus event by invoking the windowLostFocus methods on listener-a and listener-b.- Specified by:
windowLostFocusin interfaceWindowFocusListener- Parameters:
e- the window event- Since:
- 1.4
-
actionPerformed
public void actionPerformed(ActionEvent e)
Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b.- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- the action event
-
itemStateChanged
public void itemStateChanged(ItemEvent e)
Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b.- Specified by:
itemStateChangedin interfaceItemListener- Parameters:
e- the item event
-
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b.- Specified by:
adjustmentValueChangedin interfaceAdjustmentListener- Parameters:
e- the adjustment event
-
textValueChanged
public void textValueChanged(TextEvent e)
Description copied from interface:TextListenerInvoked 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:
textValueChangedin interfaceTextListener
-
inputMethodTextChanged
public void inputMethodTextChanged(InputMethodEvent e)
Handles the inputMethodTextChanged event by invoking the inputMethodTextChanged methods on listener-a and listener-b.- Specified by:
inputMethodTextChangedin interfaceInputMethodListener- Parameters:
e- the item event
-
caretPositionChanged
public void caretPositionChanged(InputMethodEvent e)
Handles the caretPositionChanged event by invoking the caretPositionChanged methods on listener-a and listener-b.- Specified by:
caretPositionChangedin interfaceInputMethodListener- Parameters:
e- the item event
-
hierarchyChanged
public void hierarchyChanged(HierarchyEvent e)
Handles the hierarchyChanged event by invoking the hierarchyChanged methods on listener-a and listener-b.- Specified by:
hierarchyChangedin interfaceHierarchyListener- Parameters:
e- the item event- Since:
- 1.3
- See Also:
HierarchyEvent.getChangeFlags()
-
ancestorMoved
public void ancestorMoved(HierarchyEvent e)
Handles the ancestorMoved event by invoking the ancestorMoved methods on listener-a and listener-b.- Specified by:
ancestorMovedin interfaceHierarchyBoundsListener- Parameters:
e- the item event- Since:
- 1.3
-
ancestorResized
public void ancestorResized(HierarchyEvent e)
Handles the ancestorResized event by invoking the ancestorResized methods on listener-a and listener-b.- Specified by:
ancestorResizedin interfaceHierarchyBoundsListener- Parameters:
e- the item event- Since:
- 1.3
-
mouseWheelMoved
public void mouseWheelMoved(MouseWheelEvent e)
Handles the mouseWheelMoved event by invoking the mouseWheelMoved methods on listener-a and listener-b.- Specified by:
mouseWheelMovedin interfaceMouseWheelListener- Parameters:
e- the mouse event- Since:
- 1.4
- See Also:
MouseWheelEvent
-
add
public static ComponentListener add(ComponentListener a, ComponentListener b)
Adds component-listener-a with component-listener-b and returns the resulting multicast listener.- Parameters:
a- component-listener-ab- component-listener-b
-
add
public static ContainerListener add(ContainerListener a, ContainerListener b)
Adds container-listener-a with container-listener-b and returns the resulting multicast listener.- Parameters:
a- container-listener-ab- container-listener-b
-
add
public static FocusListener add(FocusListener a, FocusListener b)
Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener.- Parameters:
a- focus-listener-ab- focus-listener-b
-
add
public static KeyListener add(KeyListener a, KeyListener b)
Adds key-listener-a with key-listener-b and returns the resulting multicast listener.- Parameters:
a- key-listener-ab- key-listener-b
-
add
public static MouseListener add(MouseListener a, MouseListener b)
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener.- Parameters:
a- mouse-listener-ab- mouse-listener-b
-
add
public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b)
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
-
add
public static WindowListener add(WindowListener a, WindowListener b)
Adds window-listener-a with window-listener-b and returns the resulting multicast listener.- Parameters:
a- window-listener-ab- window-listener-b
-
add
public static WindowStateListener add(WindowStateListener a, WindowStateListener b)
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- Since:
- 1.4
-
add
public static WindowFocusListener add(WindowFocusListener a, WindowFocusListener b)
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- Since:
- 1.4
-
add
public static ActionListener add(ActionListener a, ActionListener b)
Adds action-listener-a with action-listener-b and returns the resulting multicast listener.- Parameters:
a- action-listener-ab- action-listener-b
-
add
public static ItemListener add(ItemListener a, ItemListener b)
Adds item-listener-a with item-listener-b and returns the resulting multicast listener.- Parameters:
a- item-listener-ab- item-listener-b
-
add
public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b)
Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener.- Parameters:
a- adjustment-listener-ab- adjustment-listener-b
-
add
public static TextListener add(TextListener a, TextListener b)
-
add
public static InputMethodListener add(InputMethodListener a, InputMethodListener b)
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
-
add
public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
Adds hierarchy-listener-a with hierarchy-listener-b and returns the resulting multicast listener.- Parameters:
a- hierarchy-listener-ab- hierarchy-listener-b- Since:
- 1.3
-
add
public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b)
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- Since:
- 1.3
-
add
public static MouseWheelListener add(MouseWheelListener a, MouseWheelListener b)
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- Since:
- 1.4
-
remove
public static ComponentListener remove(ComponentListener l, ComponentListener oldl)
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
-
remove
public static ContainerListener remove(ContainerListener l, ContainerListener oldl)
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
-
remove
public static FocusListener remove(FocusListener l, FocusListener oldl)
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
-
remove
public static KeyListener remove(KeyListener l, KeyListener oldl)
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
-
remove
public static MouseListener remove(MouseListener l, MouseListener oldl)
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
-
remove
public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl)
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
-
remove
public static WindowListener remove(WindowListener l, WindowListener oldl)
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
-
remove
public static WindowStateListener remove(WindowStateListener l, WindowStateListener oldl)
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- Since:
- 1.4
-
remove
public static WindowFocusListener remove(WindowFocusListener l, WindowFocusListener oldl)
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- Since:
- 1.4
-
remove
public static ActionListener remove(ActionListener l, ActionListener oldl)
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
-
remove
public static ItemListener remove(ItemListener l, ItemListener oldl)
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
-
remove
public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl)
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
-
remove
public static TextListener remove(TextListener l, TextListener oldl)
-
remove
public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl)
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
-
remove
public static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl)
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- 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- Since:
- 1.3
-
remove
public static MouseWheelListener remove(MouseWheelListener l, MouseWheelListener oldl)
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- Since:
- 1.4
-
addInternal
protected static EventListener addInternal(EventListener a, EventListener b)
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
-
removeInternal
protected static EventListener removeInternal(EventListener l, EventListener oldl)
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
-
saveInternal
protected void saveInternal(ObjectOutputStream s, String k) throws IOException
- Throws:
IOException
-
save
protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException
- Throws:
IOException
-
getListeners
public static <T extends EventListener> T[] getListeners(EventListener l, Class<T> listenerType)
Returns an array of all the objects chained asFooListeners by the specifiedjava.util.EventListener.FooListeners are chained by theAWTEventMulticasterusing theaddFooListenermethod. If anulllistener 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 chanined, this method returns an empty array.- Parameters:
l- the specifiedjava.util.EventListenerlistenerType- the type of listeners requested; this parameter should specify an interface that descends fromjava.util.EventListener- Returns:
- an array of all objects chained as
FooListeners 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 specifiedlistenertypeparameter isnullClassCastException- iflistenerTypedoesn't specify a class or interface that implementsjava.util.EventListener- Since:
- 1.4
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-java/awt/AWTEventMulticaster.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.