|
||||||||||
| 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 | |