|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.AWTEventMulticaster
, AdjustmentListener
, ComponentListener
, ContainerListener
, FocusListener
, HierarchyBoundsListener
, HierarchyListener
, InputMethodListener
, ItemListener
, KeyListener
, MouseListener
, MouseMotionListener
, MouseWheelListener
, TextListener
, WindowFocusListener
, WindowListener
, WindowStateListener
, EventListener

public class AWTEventMulticaster

, ContainerListener
, FocusListener
, KeyListener
, MouseListener
, MouseMotionListener
, WindowListener
, WindowFocusListener
, WindowStateListener
, ActionListener
, ItemListener
, AdjustmentListener
, TextListener
, InputMethodListener
, HierarchyListener
, HierarchyBoundsListener
, MouseWheelListener

A class which implements efficient and thread-safe multi-cast event dispatching for the AWT events defined in the java.awt.event package. This class will manage an immutable structure consisting of a chain of event listeners and will dispatch events to those listeners. Because the structure is immutable, it is safe to use this API to add/remove listeners during the process of an event dispatch operation. However, event listeners added during the process of an event dispatch operation will not be notified of the event currently being dispatched. An example of how this class could be used to implement a new component which fires "action" events:
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());
}
}
}
| Field Summary | |
|---|---|
protected EventListener |
a
|
protected EventListener |
b
|
| Constructor Summary | |
|---|---|
protected |
AWTEventMulticaster
Creates an event multicaster instance which chains listener-a with listener-b. |
| Method Summary | ||
|---|---|---|
void |
actionPerformed
Handles the actionPerformed event by invoking the actionPerformed methods on listener-a and listener-b. |
|
static ActionListener |
add
Adds action-listener-a with action-listener-b and returns the resulting multicast listener. |
|
static AdjustmentListener |
add
Adds adjustment-listener-a with adjustment-listener-b and returns the resulting multicast listener. |
|
static ComponentListener |
add
Adds component-listener-a with component-listener-b and returns the resulting multicast listener. |
|
static ContainerListener |
add
Adds container-listener-a with container-listener-b and returns the resulting multicast listener. |
|
static FocusListener |
add
Adds focus-listener-a with focus-listener-b and returns the resulting multicast listener. |
|
static HierarchyBoundsListener |
add
Adds hierarchy-bounds-listener-a with hierarchy-bounds-listener-b and returns the resulting multicast listener. |
|
static HierarchyListener |
add
Adds hierarchy-listener-a with hierarchy-listener-b and returns the resulting multicast listener. |
|
static InputMethodListener |
add
Adds input-method-listener-a with input-method-listener-b and returns the resulting multicast listener. |
|
static ItemListener |
add
Adds item-listener-a with item-listener-b and returns the resulting multicast listener. |
|
static KeyListener |
add
Adds key-listener-a with key-listener-b and returns the resulting multicast listener. |
|
static MouseListener |
add
Adds mouse-listener-a with mouse-listener-b and returns the resulting multicast listener. |
|
static MouseMotionListener |
add
Adds mouse-motion-listener-a with mouse-motion-listener-b and returns the resulting multicast listener. |
|
static MouseWheelListener |
add
Adds mouse-wheel-listener-a with mouse-wheel-listener-b and returns the resulting multicast listener. |
|
static TextListener |
add
|
|
static WindowFocusListener |
add
Adds window-focus-listener-a with window-focus-listener-b and returns the resulting multicast listener. |
|
static WindowListener |
add
Adds window-listener-a with window-listener-b and returns the resulting multicast listener. |
|
static WindowStateListener |
add
Adds window-state-listener-a with window-state-listener-b and returns the resulting multicast listener. |
|
protected static EventListener |
addInternal
Returns the resulting multicast listener from adding listener-a and listener-b together. |
|
void |
adjustmentValueChanged
Handles the adjustmentValueChanged event by invoking the adjustmentValueChanged methods on listener-a and listener-b. |
|
void |
ancestorMoved
Handles the ancestorMoved event by invoking the ancestorMoved methods on listener-a and listener-b. |
|
void |
ancestorResized
Handles the ancestorResized event by invoking the ancestorResized methods on listener-a and listener-b. |
|
void |
caretPositionChanged
Handles the caretPositionChanged event by invoking the caretPositionChanged methods on listener-a and listener-b. |
|
void |
componentAdded
Handles the componentAdded container event by invoking the componentAdded methods on listener-a and listener-b. |
|
void |
componentHidden
Handles the componentHidden event by invoking the componentHidden methods on listener-a and listener-b. |
|
void |
componentMoved
Handles the componentMoved event by invoking the componentMoved methods on listener-a and listener-b. |
|
void |
componentRemoved
Handles the componentRemoved container event by invoking the componentRemoved methods on listener-a and listener-b. |
|
void |
componentResized
Handles the componentResized event by invoking the componentResized methods on listener-a and listener-b. |
|
void |
componentShown
Handles the componentShown event by invoking the componentShown methods on listener-a and listener-b. |
|
void |
focusGained
Handles the focusGained event by invoking the focusGained methods on listener-a and listener-b. |
|
void |
focusLost
Handles the focusLost event by invoking the focusLost methods on listener-a and listener-b. |
|
static
|
getListeners
Returns an array of all the objects chained as FooListeners by the specified
java.util.EventListener. |
|
void |
hierarchyChanged
Handles the hierarchyChanged event by invoking the hierarchyChanged methods on listener-a and listener-b. |
|
void |
inputMethodTextChanged
Handles the inputMethodTextChanged event by invoking the inputMethodTextChanged methods on listener-a and listener-b. |
|
void |
itemStateChanged
Handles the itemStateChanged event by invoking the itemStateChanged methods on listener-a and listener-b. |
|
void |
keyPressed
Handles the keyPressed event by invoking the keyPressed methods on listener-a and listener-b. |
|
void |
keyReleased
Handles the keyReleased event by invoking the keyReleased methods on listener-a and listener-b. |
|
void |
keyTyped
Handles the keyTyped event by invoking the keyTyped methods on listener-a and listener-b. |
|
void |
mouseClicked
Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and listener-b. |
|
void |
mouseDragged
Handles the mouseDragged event by invoking the mouseDragged methods on listener-a and listener-b. |
|
void |
mouseEntered
Handles the mouseEntered event by invoking the mouseEntered methods on listener-a and listener-b. |
|
void |
mouseExited
Handles the mouseExited event by invoking the mouseExited methods on listener-a and listener-b. |
|
void |
mouseMoved
Handles the mouseMoved event by invoking the mouseMoved methods on listener-a and listener-b. |
|
void |
mousePressed
Handles the mousePressed event by invoking the mousePressed methods on listener-a and listener-b. |
|
void |
mouseReleased
Handles the mouseReleased event by invoking the mouseReleased methods on listener-a and listener-b. |
|
void |
mouseWheelMoved
Handles the mouseWheelMoved event by invoking the mouseWheelMoved methods on listener-a and listener-b. |
|
static ActionListener |
remove
Removes the old action-listener from action-listener-l and returns the resulting multicast listener. |
|
static AdjustmentListener |
remove
Removes the old adjustment-listener from adjustment-listener-l and returns the resulting multicast listener. |
|
static ComponentListener |
remove
Removes the old component-listener from component-listener-l and returns the resulting multicast listener. |
|
static ContainerListener |
remove
Removes the old container-listener from container-listener-l and returns the resulting multicast listener. |
|
protected EventListener |
remove
Removes a listener from this multicaster and returns the resulting multicast listener. |
|
static FocusListener |
remove
Removes the old focus-listener from focus-listener-l and returns the resulting multicast listener. |
|
static HierarchyBoundsListener |
remove
Removes the old hierarchy-bounds-listener from hierarchy-bounds-listener-l and returns the resulting multicast listener. |
|
static HierarchyListener |
remove
Removes the old hierarchy-listener from hierarchy-listener-l and returns the resulting multicast listener. |
|
static InputMethodListener |
remove
Removes the old input-method-listener from input-method-listener-l and returns the resulting multicast listener. |
|
static ItemListener |
remove
Removes the old item-listener from item-listener-l and returns the resulting multicast listener. |
|
static KeyListener |
remove
Removes the old key-listener from key-listener-l and returns the resulting multicast listener. |
|
static MouseListener |
remove
Removes the old mouse-listener from mouse-listener-l and returns the resulting multicast listener. |
|
static MouseMotionListener |
remove
Removes the old mouse-motion-listener from mouse-motion-listener-l and returns the resulting multicast listener. |
|
static MouseWheelListener |
remove
Removes the old mouse-wheel-listener from mouse-wheel-listener-l and returns the resulting multicast listener. |
|
static TextListener |
remove
|
|
static WindowFocusListener |
remove
Removes the old window-focus-listener from window-focus-listener-l and returns the resulting multicast listener. |
|
static WindowListener |
remove
Removes the old window-listener from window-listener-l and returns the resulting multicast listener. |
|
static WindowStateListener |
remove
Removes the old window-state-listener from window-state-listener-l and returns the resulting multicast listener. |
|
protected static EventListener |
removeInternal
Returns the resulting multicast listener after removing the old listener from listener-l. |
|
protected static void |
save
|
|
protected void |
saveInternal
|
|
void |
textValueChanged
Invoked when the value of the text has changed. |
|
void |
windowActivated
Handles the windowActivated event by invoking the windowActivated methods on listener-a and listener-b. |
|
void |
windowClosed
Handles the windowClosed event by invoking the windowClosed methods on listener-a and listener-b. |
|
void |
windowClosing
Handles the windowClosing event by invoking the windowClosing methods on listener-a and listener-b. |
|
void |
windowDeactivated
Handles the windowDeactivated event by invoking the windowDeactivated methods on listener-a and listener-b. |
|
void |
windowDeiconified
Handles the windowDeiconfied event by invoking the windowDeiconified methods on listener-a and listener-b. |
|
void |
windowGainedFocus
Handles the windowGainedFocus event by invoking the windowGainedFocus methods on listener-a and listener-b. |
|
void |
windowIconified
Handles the windowIconified event by invoking the windowIconified methods on listener-a and listener-b. |
|
void |
windowLostFocus
Handles the windowLostFocus event by invoking the windowLostFocus methods on listener-a and listener-b. |
|
void |
windowOpened
Handles the windowOpened event by invoking the windowOpened methods on listener-a and listener-b. |
|
void |
windowStateChanged
Handles the windowStateChanged event by invoking the windowStateChanged methods on listener-a and listener-b. |
|
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Field Detail |
|---|

protected final EventListener![]()
![]()
a

protected final EventListener![]()
![]()
b
| Constructor Detail |
|---|

protected AWTEventMulticaster(EventListener![]()
![]()
a, EventListener
![]()
![]()
b)
a and b
should not be null, though implementations may vary in
choosing whether or not to throw NullPointerException
in that case.
a - listener-ab - listener-b| Method Detail |
|---|

protected EventListener![]()
![]()
remove(EventListener
![]()
![]()
oldl)
oldl - the listener to be removed

public void componentResized(ComponentEvent![]()
![]()
e)
componentResized

in interface ComponentListener

e - the component event

public void componentMoved(ComponentEvent![]()
![]()
e)
componentMoved

in interface ComponentListener

e - the component event

public void componentShown(ComponentEvent![]()
![]()
e)
componentShown

in interface ComponentListener

e - the component event

public void componentHidden(ComponentEvent![]()
![]()
e)
componentHidden

in interface ComponentListener

e - the component event

public void componentAdded(ContainerEvent![]()
![]()
e)
componentAdded

in interface ContainerListener

e - the component event

public void componentRemoved(ContainerEvent![]()
![]()
e)
componentRemoved

in interface ContainerListener

e - the component event

public void focusGained(FocusEvent![]()
![]()
e)
focusGained

in interface FocusListener

e - the focus event

public void focusLost(FocusEvent![]()
![]()
e)
focusLost

in interface FocusListener

e - the focus event

public void keyTyped(KeyEvent![]()
![]()
e)
keyTyped

in interface KeyListener

e - the key event

public void keyPressed(KeyEvent![]()
![]()
e)
keyPressed

in interface KeyListener

e - the key event

public void keyReleased(KeyEvent![]()
![]()
e)
keyReleased

in interface KeyListener

e - the key event

public void mouseClicked(MouseEvent![]()
![]()
e)
mouseClicked

in interface MouseListener

e - the mouse event

public void mousePressed(MouseEvent![]()
![]()
e)
mousePressed

in interface MouseListener

e - the mouse event

public void mouseReleased(MouseEvent![]()
![]()
e)
mouseReleased

in interface MouseListener

e - the mouse event

public void mouseEntered(MouseEvent![]()
![]()
e)
mouseEntered

in interface MouseListener

e - the mouse event

public void mouseExited(MouseEvent![]()
![]()
e)
mouseExited

in interface MouseListener

e - the mouse event

public void mouseDragged(MouseEvent![]()
![]()
e)
mouseDragged

in interface MouseMotionListener

e - the mouse event

public void mouseMoved(MouseEvent![]()
![]()
e)
mouseMoved

in interface MouseMotionListener

e - the mouse event

public void windowOpened(WindowEvent![]()
![]()
e)
windowOpened

in interface WindowListener

e - the window event

public void windowClosing(WindowEvent![]()
![]()
e)
windowClosing

in interface WindowListener

e - the window event

public void windowClosed(WindowEvent![]()
![]()
e)
windowClosed

in interface WindowListener

e - the window event

public void windowIconified(WindowEvent![]()
![]()
e)
windowIconified

in interface WindowListener

e - the window eventFrame.setIconImage(java.awt.Image)


public void windowDeiconified(WindowEvent![]()
![]()
e)
windowDeiconified

in interface WindowListener

e - the window event

public void windowActivated(WindowEvent![]()
![]()
e)
windowActivated

in interface WindowListener

e - the window event

public void windowDeactivated(WindowEvent![]()
![]()
e)
windowDeactivated

in interface WindowListener

e - the window event

public void windowStateChanged(WindowEvent![]()
![]()
e)
windowStateChanged

in interface WindowStateListener

e - the window event

public void windowGainedFocus(WindowEvent![]()
![]()
e)
windowGainedFocus

in interface WindowFocusListener

e - the window event

public void windowLostFocus(WindowEvent![]()
![]()
e)
windowLostFocus

in interface WindowFocusListener

e - the window event

public void actionPerformed(ActionEvent![]()
![]()
e)
actionPerformed

in interface ActionListener

e - the action event

public void itemStateChanged(ItemEvent![]()
![]()
e)
itemStateChanged

in interface ItemListener

e - the item event

public void adjustmentValueChanged(AdjustmentEvent![]()
![]()
e)
adjustmentValueChanged

in interface AdjustmentListener

e - the adjustment event

public void textValueChanged(TextEvent![]()
![]()
e)
TextListener

textValueChanged

in interface TextListener


public void inputMethodTextChanged(InputMethodEvent![]()
![]()
e)
inputMethodTextChanged

in interface InputMethodListener

e - the item event

public void caretPositionChanged(InputMethodEvent![]()
![]()
e)
caretPositionChanged

in interface InputMethodListener

e - the item event

public void hierarchyChanged(HierarchyEvent![]()
![]()
e)
hierarchyChanged

in interface HierarchyListener

e - the item eventHierarchyEvent.getChangeFlags()


public void ancestorMoved(HierarchyEvent![]()
![]()
e)
ancestorMoved

in interface HierarchyBoundsListener

e - the item event

public void ancestorResized(HierarchyEvent![]()
![]()
e)
ancestorResized

in interface HierarchyBoundsListener

e - the item event

public void mouseWheelMoved(MouseWheelEvent![]()
![]()
e)
mouseWheelMoved

in interface MouseWheelListener

e - the mouse eventMouseWheelEvent


public static ComponentListener![]()
![]()
add(ComponentListener
![]()
![]()
a, ComponentListener
![]()
![]()
b)
a - component-listener-ab - component-listener-b

public static ContainerListener![]()
![]()
add(ContainerListener
![]()
![]()
a, ContainerListener
![]()
![]()
b)
a - container-listener-ab - container-listener-b

public static FocusListener![]()
![]()
add(FocusListener
![]()
![]()
a, FocusListener
![]()
![]()
b)
a - focus-listener-ab - focus-listener-b

public static KeyListener![]()
![]()
add(KeyListener
![]()
![]()
a, KeyListener
![]()
![]()
b)
a - key-listener-ab - key-listener-b

public static MouseListener![]()
![]()
add(MouseListener
![]()
![]()
a, MouseListener
![]()
![]()
b)
a - mouse-listener-ab - mouse-listener-b

public static MouseMotionListener![]()
![]()
add(MouseMotionListener
![]()
![]()
a, MouseMotionListener
![]()
![]()
b)
a - mouse-motion-listener-ab - mouse-motion-listener-b

public static WindowListener![]()
![]()
add(WindowListener
![]()
![]()
a, WindowListener
![]()
![]()
b)
a - window-listener-ab - window-listener-b

public static WindowStateListener![]()
![]()
add(WindowStateListener
![]()
![]()
a, WindowStateListener
![]()
![]()
b)
a - window-state-listener-ab - window-state-listener-b

public static WindowFocusListener![]()
![]()
add(WindowFocusListener
![]()
![]()
a, WindowFocusListener
![]()
![]()
b)
a - window-focus-listener-ab - window-focus-listener-b

public static ActionListener![]()
![]()
add(ActionListener
![]()
![]()
a, ActionListener
![]()
![]()
b)
a - action-listener-ab - action-listener-b

public static ItemListener![]()
![]()
add(ItemListener
![]()
![]()
a, ItemListener
![]()
![]()
b)
a - item-listener-ab - item-listener-b

public static AdjustmentListener![]()
![]()
add(AdjustmentListener
![]()
![]()
a, AdjustmentListener
![]()
![]()
b)
a - adjustment-listener-ab - adjustment-listener-b

public static TextListener![]()
![]()
add(TextListener
![]()
![]()
a, TextListener
![]()
![]()
b)

public static InputMethodListener![]()
![]()
add(InputMethodListener
![]()
![]()
a, InputMethodListener
![]()
![]()
b)
a - input-method-listener-ab - input-method-listener-b

public static HierarchyListener![]()
![]()
add(HierarchyListener
![]()
![]()
a, HierarchyListener
![]()
![]()
b)
a - hierarchy-listener-ab - hierarchy-listener-b

public static HierarchyBoundsListener![]()
![]()
add(HierarchyBoundsListener
![]()
![]()
a, HierarchyBoundsListener
![]()
![]()
b)
a - hierarchy-bounds-listener-ab - hierarchy-bounds-listener-b

public static MouseWheelListener![]()
![]()
add(MouseWheelListener
![]()
![]()
a, MouseWheelListener
![]()
![]()
b)
a - mouse-wheel-listener-ab - mouse-wheel-listener-b

public static ComponentListener![]()
![]()
remove(ComponentListener
![]()
![]()
l, ComponentListener
![]()
![]()
oldl)
l - component-listener-loldl - the component-listener being removed

public static ContainerListener![]()
![]()
remove(ContainerListener
![]()
![]()
l, ContainerListener
![]()
![]()
oldl)
l - container-listener-loldl - the container-listener being removed

public static FocusListener![]()
![]()
remove(FocusListener
![]()
![]()
l, FocusListener
![]()
![]()
oldl)
l - focus-listener-loldl - the focus-listener being removed

public static KeyListener![]()
![]()
remove(KeyListener
![]()
![]()
l, KeyListener
![]()
![]()
oldl)
l - key-listener-loldl - the key-listener being removed

public static MouseListener![]()
![]()
remove(MouseListener
![]()
![]()
l, MouseListener
![]()
![]()
oldl)
l - mouse-listener-loldl - the mouse-listener being removed

public static MouseMotionListener![]()
![]()
remove(MouseMotionListener
![]()
![]()
l, MouseMotionListener
![]()
![]()
oldl)
l - mouse-motion-listener-loldl - the mouse-motion-listener being removed

public static WindowListener![]()
![]()
remove(WindowListener
![]()
![]()
l, WindowListener
![]()
![]()
oldl)
l - window-listener-loldl - the window-listener being removed

public static WindowStateListener![]()
![]()
remove(WindowStateListener
![]()
![]()
l, WindowStateListener
![]()
![]()
oldl)
l - window-state-listener-loldl - the window-state-listener being removed

public static WindowFocusListener![]()
![]()
remove(WindowFocusListener
![]()
![]()
l, WindowFocusListener
![]()
![]()
oldl)
l - window-focus-listener-loldl - the window-focus-listener being removed

public static ActionListener![]()
![]()
remove(ActionListener
![]()
![]()
l, ActionListener
![]()
![]()
oldl)
l - action-listener-loldl - the action-listener being removed

public static ItemListener![]()
![]()
remove(ItemListener
![]()
![]()
l, ItemListener
![]()
![]()
oldl)
l - item-listener-loldl - the item-listener being removed

public static AdjustmentListener![]()
![]()
remove(AdjustmentListener
![]()
![]()
l, AdjustmentListener
![]()
![]()
oldl)
l - adjustment-listener-loldl - the adjustment-listener being removed

public static TextListener![]()
![]()
remove(TextListener
![]()
![]()
l, TextListener
![]()
![]()
oldl)

public static InputMethodListener![]()
![]()
remove(InputMethodListener
![]()
![]()
l, InputMethodListener
![]()
![]()
oldl)
l - input-method-listener-loldl - the input-method-listener being removed

public static HierarchyListener![]()
![]()
remove(HierarchyListener
![]()
![]()
l, HierarchyListener
![]()
![]()
oldl)
l - hierarchy-listener-loldl - the hierarchy-listener being removed

public static HierarchyBoundsListener![]()
![]()
remove(HierarchyBoundsListener
![]()
![]()
l, HierarchyBoundsListener
![]()
![]()
oldl)
l - hierarchy-bounds-listener-loldl - the hierarchy-bounds-listener being removed

public static MouseWheelListener![]()
![]()
remove(MouseWheelListener
![]()
![]()
l, MouseWheelListener
![]()
![]()
oldl)
l - mouse-wheel-listener-loldl - the mouse-wheel-listener being removed

protected static EventListener![]()
![]()
addInternal(EventListener
![]()
![]()
a, EventListener
![]()
![]()
b)
a - event listener-ab - event listener-b

protected static EventListener![]()
![]()
removeInternal(EventListener
![]()
![]()
l, EventListener
![]()
![]()
oldl)
l - the listener being removed fromoldl - the listener being removed

protected void saveInternal(ObjectOutputStream![]()
![]()
s, String
![]()
![]()
k) throws IOException
![]()
![]()
IOException


protected static void save(ObjectOutputStream![]()
![]()
s, String
![]()
![]()
k, EventListener
![]()
![]()
l) throws IOException
![]()
![]()
<