JavaTM 2 Platform
Standard Ed. 6

java.awt
类 AWTEventMulticaster

java.lang.Object
  继承者 java.awt.AWTEventMulticaster
所有已实现的接口:
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

AWTEventMulticaster 实现对 java.awt.event 包中定义的 AWT 事件的指派,该指派是有效的、线程安全的多路广播事件指派。

以下实例阐释了如何使用此类:


 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());
         }
     }
 }
 
需要重点注意的是 addremove 方法的第一个参数,它是维护侦听器的字段。此外,必须将 addremove 方法的结果分配给维护侦听器的字段。

AWTEventMulticaster 是作为一对 EventListeners 实现的,它们在构造时被设置。AWTEventMulticaster 是不可变的。addremove 方法不得以任何方式改变 AWTEventMulticaster。如有必要,可以创建一个新的 AWTEventMulticaster。以这种方式在指派事件的过程中添加和移除侦听器是安全的。但是,不会向目前正指派的事件通知事件指派操作过程中添加的事件侦听器。

允许所有 add 方法使用 null 参数。如果第一个参数是 null,则返回第二个参数。如果第一个参数不是 null,而第二个参数是 null,则返回第一个参数。如果两个参数都是 non-null,则使用这两个参数创建一个新的 AWTEventMulticaster 并返回它。

对于使用两个参数的 remove 方法,返回以下内容:

Swing 基于类似的逻辑使用 EventListenerList。有关细节,请参见 EventListenerList

从以下版本开始:
1.1
另请参见:
EventListenerList

字段摘要
protected  EventListener a
           
protected  EventListener b
           
 
构造方法摘要
protected AWTEventMulticaster(EventListener a, EventListener b)
          创建一个将侦听器 a 和侦听器 b 链接起来的事件多路广播器实例。
 
方法摘要
 void actionPerformed(ActionEvent e)
          通过在侦听器 a 和侦听器 b 上调用 actionPerformed 方法处理 actionPerformed 事件。
static ActionListener add(ActionListener a, ActionListener b)
          添加操作侦听器 a 和操作侦听器 b,并返回得到的多路广播侦听器。
static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b)
          添加调整侦听器 a 和调整侦听器 b,并返回得到的多路广播侦听器。
static ComponentListener add(ComponentListener a, ComponentListener b)
          添加组件侦听器 a 和组件侦听器 b,并返回得到的多路广播侦听器。
static ContainerListener add(ContainerListener a, ContainerListener b)
          添加容器侦听器 a 和容器侦听器 b,并返回得到的多路广播侦听器。
static FocusListener add(FocusListener a, FocusListener b)
          添加焦点侦听器 a 和焦点侦听器 b,并返回得到的多路广播侦听器。
static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b)
          添加层次结构边界侦听器 a 和层次结构边界侦听器 b,并返回得到的多路广播侦听器。
static HierarchyListener add(HierarchyListener a, HierarchyListener b)
          添加层次结构侦听器 a 和层次结构侦听器 b,并返回得到的多路广播侦听器。
static InputMethodListener add(InputMethodListener a, InputMethodListener b)
          添加输入方法侦听器 a 和输入方法侦听器 b,并返回得到的多路广播侦听器。
static ItemListener add(ItemListener a, ItemListener b)
          添加项侦听器 a 和项侦听器 b,并返回得到的多路广播侦听器。
static KeyListener add(KeyListener a, KeyListener b)
          添加键侦听器 a 和键侦听器 b,并返回得到的多路广播侦听器。
static MouseListener add(MouseListener a, MouseListener b)
          添加鼠标侦听器 a 和鼠标侦听器 b,并返回得到的多路广播侦听器。
static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b)
          添加鼠标移动侦听器 a 和鼠标移动侦听器 b,并返回得到的多路广播侦听器。
static MouseWheelListener add(MouseWheelListener a, MouseWheelListener b)
          添加鼠标滚轮侦听器 a 和鼠标滚轮侦听器 b,并返回得到的多路广播侦听器。
static TextListener add(TextListener a, TextListener b)
           
static WindowFocusListener add(WindowFocusListener a, WindowFocusListener b)
          添加窗口焦点侦听器 a 和窗口焦点侦听器 b,并返回得到的多路广播侦听器。
static WindowListener add(WindowListener a, WindowListener b)
          添加窗口侦听器 a 和窗口侦听器 b,并返回得到的多路广播侦听器。
static WindowStateListener add(WindowStateListener a, WindowStateListener b)
          添加窗口状态侦听器 a 和窗口状态侦听器 b,并返回得到的多路广播侦听器。
protected static EventListener addInternal(EventListener a, EventListener b)
          从正添加的侦听器 a 和侦听器 b 中一起返回得到的多路广播侦听器。
 void adjustmentValueChanged(AdjustmentEvent e)
          通过在侦听器 a 和侦听器 b 上调用 adjustmentValueChanged 方法处理 adjustmentValueChanged 事件。
 void ancestorMoved(HierarchyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 ancestorMoved 方法处理 ancestorMoved 事件。
 void ancestorResized(HierarchyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 ancestorResized 方法处理 ancestorResized 事件。
 void caretPositionChanged(InputMethodEvent e)
          通过在侦听器 a 和侦听器 b 上调用 caretPositionChanged 方法处理 caretPositionChanged 事件。
 void componentAdded(ContainerEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentAdded 方法处理 componentAdded 容器事件。
 void componentHidden(ComponentEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentHidden 方法处理 componentHidden 事件。
 void componentMoved(ComponentEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentMoved 方法处理 componentMoved 事件。
 void componentRemoved(ContainerEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentRemoved 方法处理 componentRemoved 容器事件。
 void componentResized(ComponentEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentResized 方法处理 componentResized 事件。
 void componentShown(ComponentEvent e)
          通过在侦听器 a 和侦听器 b 上调用 componentShown 方法处理 componentShown 事件。
 void focusGained(FocusEvent e)
          通过在侦听器 a 和侦听器 b 上调用 focusGained 方法处理 focusGained 事件。
 void focusLost(FocusEvent e)
          通过在侦听器 a 和侦听器 b 上调用 focusLost 方法处理 focusLost 事件。
static
<T extends EventListener>
T[]
getListeners(EventListener l, Class<T> listenerType)
          返回通过指定的 java.util.EventListener 链接为 FooListener 的所有对象的数组。
 void hierarchyChanged(HierarchyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 hierarchyChanged 方法处理 hierarchyChanged 事件。
 void inputMethodTextChanged(InputMethodEvent e)
          通过在侦听器 a 和侦听器 b 上调用 inputMethodTextChanged 方法处理 inputMethodTextChanged 事件。
 void itemStateChanged(ItemEvent e)
          通过在侦听器 a 和侦听器 b 上调用 itemStateChanged 方法处理 itemStateChanged 事件。
 void keyPressed(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyPressed 方法处理 keyPressed 事件。
 void keyReleased(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyReleased 方法处理 keyReleased 事件。
 void keyTyped(KeyEvent e)
          通过在侦听器 a 和侦听器 b 上调用 keyTyped 方法处理 keyTyped 事件。
 void mouseClicked(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseClicked 方法处理 mouseClicked 事件。
 void mouseDragged(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseDragged 方法处理 mouseDragged 事件。
 void mouseEntered(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseEntered 方法处理 mouseEntered 事件。
 void mouseExited(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseExited 方法处理 mouseExited 事件。
 void mouseMoved(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseMoved 方法处理 mouseMoved 事件。
 void mousePressed(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mousePressed 方法处理 mousePressed 事件。
 void mouseReleased(MouseEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseReleased 方法处理 mouseReleased 事件。
 void mouseWheelMoved(MouseWheelEvent e)
          通过在侦听器 a 和侦听器 b 上调用 mouseWheelMoved 方法处理 mouseWheelMoved 事件。
static ActionListener remove(ActionListener l, ActionListener oldl)
          从操作侦听器 l 中移除旧的操作侦听器,并返回得到的多路广播侦听器。
static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl)
          从调整侦听器 l 中移除旧的调整侦听器,并返回得到的多路广播侦听器。
static ComponentListener remove(ComponentListener l, ComponentListener oldl)
          从组件侦听器 l 中移除旧的组件侦听器,并返回得到的多路广播侦听器。
static ContainerListener remove(ContainerListener l, ContainerListener oldl)
          从容器侦听器 l 中移除旧的容器侦听器,并返回得到的多路广播侦听器。
protected  EventListener remove(EventListener oldl)
          从此多路广播器中移除一个侦听器。
static FocusListener remove(FocusListener l, FocusListener oldl)
          从焦点侦听器 l 中移除旧的焦点侦听器,并返回得到的多路广播侦听器。
static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl)
          从层次结构边界侦听器 l 中移除旧的层次结构边界侦听器,并返回得到的多路广播侦听器。
static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl)
          从层次结构侦听器 l 中移除旧的层次结构侦听器,并返回得到的多路广播侦听器。
static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl)
          从输入方法侦听器 l 中移除旧的输入方法侦听器,并返回得到的多路广播侦听器。
static ItemListener remove(ItemListener l, ItemListener oldl)
          从项侦听器 l 中移除旧的项侦听器,并返回得到的多路广播侦听器。
static KeyListener remove(KeyListener l, KeyListener oldl)
          从键侦听器 l 中移除旧的键侦听器,并返回得到的多路广播侦听器。
static MouseListener remove(MouseListener l, MouseListener oldl)
          从鼠标侦听器 l 中移除旧的鼠标侦听器,并返回得到的多路广播侦听器。
static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl)
          从鼠标移动侦听器 l 中移除旧的鼠标移动侦听器,并返回得到的多路广播侦听器。
static MouseWheelListener remove(MouseWheelListener l, MouseWheelListener oldl)
          从鼠标滚轮侦听器 l 中移除旧的鼠标滚轮侦听器,并返回得到的多路广播侦听器。
static TextListener remove(TextListener l, TextListener oldl)
           
static WindowFocusListener remove(WindowFocusListener l, WindowFocusListener oldl)
          从窗口焦点侦听器 l 中移除旧的窗口焦点侦听器,并返回得到的多路广播侦听器。
static WindowListener remove(WindowListener l, WindowListener oldl)
          从窗口侦听器 l 中移除旧的窗口侦听器,并返回得到的多路广播侦听器。
static WindowStateListener remove(WindowStateListener l, WindowStateListener oldl)
          从窗口状态侦听器 l 中移除旧的窗口状态侦听器,并返回得到的多路广播侦听器。
protected static EventListener removeInternal(EventListener l, EventListener oldl)
          在从侦听器 l 中移除旧的侦听器之后,返回得到的多路广播侦听器。
protected static void save(ObjectOutputStream s, String k, EventListener l)
           
protected  void saveInternal(ObjectOutputStream s, String k)
           
 void textValueChanged(TextEvent e)
          文本的值已改变时调用。
 void windowActivated(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowActivated 方法处理 windowActivated 事件。
 void windowClosed(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowClosed 方法处理 windowClosed 事件。
 void windowClosing(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowClosing 方法处理 windowClosing 事件。
 void windowDeactivated(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowDeactivated 方法处理 windowDeactivated 事件。
 void windowDeiconified(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowDeiconified 方法处理 windowDeiconified 事件。
 void windowGainedFocus(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowGainedFocus 方法处理 windowGainedFocus 事件。
 void windowIconified(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowIconified 方法处理 windowIconified 事件。
 void windowLostFocus(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowLostFocus 方法处理 windowLostFocus 事件。
 void windowOpened(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowOpened 方法处理 windowOpened 事件。
 void windowStateChanged(WindowEvent e)
          通过在侦听器 a 和侦听器 b 上调用 windowStateChanged 方法处理 windowStateChanged 事件。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

a

protected final EventListener a

b

protected final EventListener b
构造方法详细信息

AWTEventMulticaster

protected AWTEventMulticaster(EventListener a,
                              EventListener b)
创建一个将侦听器 a 和侦听器 b 链接起来的事件多路广播器实例。输入参数 ab 不应为 null,对于是否选择在这种情况下抛出 NullPointerException,因实现不同而各不相同。

参数:
a - 侦听器 a
b - 侦听器 b
方法详细信息

remove

protected EventListener remove(EventListener oldl)
从此多路广播器中移除一个侦听器。

除了所有出现的 oldl 之外,返回的多路广播器包含此多路广播器中的所有侦听器。如果得到的多路广播器只包含可能返回的常规侦听器。如果得到的多路广播器为空,则可能返回 null

如果 oldlnull,不会有异常抛出。

参数:
oldl - 要移除的侦听器
返回:
得到的侦听器

componentResized

public void componentResized(ComponentEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentResized 方法处理 componentResized 事件。

指定者:
接口 ComponentListener 中的 componentResized
参数:
e - 组件事件

componentMoved

public void componentMoved(ComponentEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentMoved 方法处理 componentMoved 事件。

指定者:
接口 ComponentListener 中的 componentMoved
参数:
e - 组件事件

componentShown

public void componentShown(ComponentEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentShown 方法处理 componentShown 事件。

指定者:
接口 ComponentListener 中的 componentShown
参数:
e - 组件事件

componentHidden

public void componentHidden(ComponentEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentHidden 方法处理 componentHidden 事件。

指定者:
接口 ComponentListener 中的 componentHidden
参数:
e - 组件事件

componentAdded

public void componentAdded(ContainerEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentAdded 方法处理 componentAdded 容器事件。

指定者:
接口 ContainerListener 中的 componentAdded
参数:
e - 组件事件

componentRemoved

public void componentRemoved(ContainerEvent e)
通过在侦听器 a 和侦听器 b 上调用 componentRemoved 方法处理 componentRemoved 容器事件。

指定者:
接口 ContainerListener 中的 componentRemoved
参数:
e - 组件事件

focusGained

public void focusGained(FocusEvent e)
通过在侦听器 a 和侦听器 b 上调用 focusGained 方法处理 focusGained 事件。

指定者:
接口 FocusListener 中的 focusGained
参数:
e - 焦点事件

focusLost

public void focusLost(FocusEvent e)
通过在侦听器 a 和侦听器 b 上调用 focusLost 方法处理 focusLost 事件。

指定者:
接口 FocusListener 中的 focusLost
参数:
e - 焦点事件

keyTyped

public void keyTyped(KeyEvent e)
通过在侦听器 a 和侦听器 b 上调用 keyTyped 方法处理 keyTyped 事件。

指定者:
接口 KeyListener 中的 keyTyped
参数:
e - 键事件

keyPressed

public void keyPressed(KeyEvent e)
通过在侦听器 a 和侦听器 b 上调用 keyPressed 方法处理 keyPressed 事件。

指定者:
接口 KeyListener 中的 keyPressed
参数:
e - 键事件

keyReleased

public void keyReleased(KeyEvent e)
通过在侦听器 a 和侦听器 b 上调用 keyReleased 方法处理 keyReleased 事件。

指定者:
接口 KeyListener 中的 keyReleased
参数:
e - 键事件

mouseClicked

public void mouseClicked(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseClicked 方法处理 mouseClicked 事件。

指定者:
接口 MouseListener 中的 mouseClicked
参数:
e - 鼠标事件

mousePressed

public void mousePressed(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mousePressed 方法处理 mousePressed 事件。

指定者:
接口 MouseListener 中的 mousePressed
参数:
e - 鼠标事件

mouseReleased

public void mouseReleased(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseReleased 方法处理 mouseReleased 事件。

指定者:
接口 MouseListener 中的 mouseReleased
参数:
e - 鼠标事件

mouseEntered

public void mouseEntered(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseEntered 方法处理 mouseEntered 事件。

指定者:
接口 MouseListener 中的 mouseEntered
参数:
e - 鼠标事件

mouseExited

public void mouseExited(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseExited 方法处理 mouseExited 事件。

指定者:
接口 MouseListener 中的 mouseExited
参数:
e - 鼠标事件

mouseDragged

public void mouseDragged(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseDragged 方法处理 mouseDragged 事件。

指定者:
接口 MouseMotionListener 中的 mouseDragged
参数:
e - 鼠标事件

mouseMoved

public void mouseMoved(MouseEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseMoved 方法处理 mouseMoved 事件。

指定者:
接口 MouseMotionListener 中的 mouseMoved
参数:
e - 鼠标事件

windowOpened

public void windowOpened(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowOpened 方法处理 windowOpened 事件。

指定者:
接口 WindowListener 中的 windowOpened
参数:
e - 窗口事件

windowClosing

public void windowClosing(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowClosing 方法处理 windowClosing 事件。

指定者:
接口 WindowListener 中的 windowClosing
参数:
e - 窗口事件

windowClosed

public void windowClosed(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowClosed 方法处理 windowClosed 事件。

指定者:
接口 WindowListener 中的 windowClosed
参数:
e - 窗口事件

windowIconified

public void windowIconified(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowIconified 方法处理 windowIconified 事件。

指定者:
接口 WindowListener 中的 windowIconified
参数:
e - 窗口事件
另请参见:
Frame.setIconImage(java.awt.Image)

windowDeiconified

public void windowDeiconified(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowDeiconified 方法处理 windowDeiconified 事件。

指定者:
接口 WindowListener 中的 windowDeiconified
参数:
e - 窗口事件

windowActivated

public void windowActivated(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowActivated 方法处理 windowActivated 事件。

指定者:
接口 WindowListener 中的 windowActivated
参数:
e - 窗口事件

windowDeactivated

public void windowDeactivated(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowDeactivated 方法处理 windowDeactivated 事件。

指定者:
接口 WindowListener 中的 windowDeactivated
参数:
e - 窗口事件

windowStateChanged

public void windowStateChanged(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowStateChanged 方法处理 windowStateChanged 事件。

指定者:
接口 WindowStateListener 中的 windowStateChanged
参数:
e - 窗口事件
从以下版本开始:
1.4

windowGainedFocus

public void windowGainedFocus(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowGainedFocus 方法处理 windowGainedFocus 事件。

指定者:
接口 WindowFocusListener 中的 windowGainedFocus
参数:
e - 窗口事件
从以下版本开始:
1.4

windowLostFocus

public void windowLostFocus(WindowEvent e)
通过在侦听器 a 和侦听器 b 上调用 windowLostFocus 方法处理 windowLostFocus 事件。

指定者:
接口 WindowFocusListener 中的 windowLostFocus
参数:
e - 窗口事件
从以下版本开始:
1.4

actionPerformed

public void actionPerformed(ActionEvent e)
通过在侦听器 a 和侦听器 b 上调用 actionPerformed 方法处理 actionPerformed 事件。

指定者:
接口 ActionListener 中的 actionPerformed
参数:
e - 操作事件

itemStateChanged

public void itemStateChanged(ItemEvent e)
通过在侦听器 a 和侦听器 b 上调用 itemStateChanged 方法处理 itemStateChanged 事件。

指定者:
接口 ItemListener 中的 itemStateChanged
参数:
e - 项事件

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)
通过在侦听器 a 和侦听器 b 上调用 adjustmentValueChanged 方法处理 adjustmentValueChanged 事件。

指定者:
接口 AdjustmentListener 中的 adjustmentValueChanged
参数:
e - 调整事件

textValueChanged

public void textValueChanged(TextEvent e)
从接口 TextListener 复制的描述
文本的值已改变时调用。为此方法所编写的代码在文本改变时执行所需的操作。

指定者:
接口 TextListener 中的 textValueChanged

inputMethodTextChanged

public void inputMethodTextChanged(InputMethodEvent e)
通过在侦听器 a 和侦听器 b 上调用 inputMethodTextChanged 方法处理 inputMethodTextChanged 事件。

指定者:
接口 InputMethodListener 中的 inputMethodTextChanged
参数:
e - 项事件

caretPositionChanged

public void caretPositionChanged(InputMethodEvent e)
通过在侦听器 a 和侦听器 b 上调用 caretPositionChanged 方法处理 caretPositionChanged 事件。

指定者:
接口 InputMethodListener 中的 caretPositionChanged
参数:
e - 项事件

hierarchyChanged

public void hierarchyChanged(HierarchyEvent e)
通过在侦听器 a 和侦听器 b 上调用 hierarchyChanged 方法处理 hierarchyChanged 事件。

指定者:
接口 HierarchyListener 中的 hierarchyChanged
参数:
e - 项事件
从以下版本开始:
1.3
另请参见:
HierarchyEvent.getChangeFlags()

ancestorMoved

public void ancestorMoved(HierarchyEvent e)
通过在侦听器 a 和侦听器 b 上调用 ancestorMoved 方法处理 ancestorMoved 事件。

指定者:
接口 HierarchyBoundsListener 中的 ancestorMoved
参数:
e - 项事件
从以下版本开始:
1.3

ancestorResized

public void ancestorResized(HierarchyEvent e)
通过在侦听器 a 和侦听器 b 上调用 ancestorResized 方法处理 ancestorResized 事件。

指定者:
接口 HierarchyBoundsListener 中的 ancestorResized
参数:
e - 项事件
从以下版本开始:
1.3

mouseWheelMoved

public void mouseWheelMoved(MouseWheelEvent e)
通过在侦听器 a 和侦听器 b 上调用 mouseWheelMoved 方法处理 mouseWheelMoved 事件。

指定者:
接口 MouseWheelListener 中的 mouseWheelMoved
参数:
e - 鼠标事件
从以下版本开始:
1.4
另请参见:
MouseWheelEvent

add

public static ComponentListener add(ComponentListener a,
                                    ComponentListener b)
添加组件侦听器 a 和组件侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 组件侦听器 a
b - 组件侦听器 b

add

public static ContainerListener add(ContainerListener a,
                                    ContainerListener b)
添加容器侦听器 a 和容器侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 容器侦听器 a
b - 容器侦听器 b

add

public static FocusListener add(FocusListener a,
                                FocusListener b)
添加焦点侦听器 a 和焦点侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 焦点侦听器 a
b - 焦点侦听器 b

add

public static KeyListener add(KeyListener a,
                              KeyListener b)
添加键侦听器 a 和键侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 键侦听器 a
b - 键侦听器 b

add

public static MouseListener add(MouseListener a,
                                MouseListener b)
添加鼠标侦听器 a 和鼠标侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 鼠标侦听器 a
b - 鼠标侦听器 b

add

public static MouseMotionListener add(MouseMotionListener a,
                                      MouseMotionListener b)
添加鼠标移动侦听器 a 和鼠标移动侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 鼠标移动侦听器 a
b - 鼠标移动侦听器 b

add

public static WindowListener add(WindowListener a,
                                 WindowListener b)
添加窗口侦听器 a 和窗口侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 窗口侦听器 a
b - 窗口侦听器 b

add

public static WindowStateListener add(WindowStateListener a,
                                      WindowStateListener b)
添加窗口状态侦听器 a 和窗口状态侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 窗口状态侦听器 a
b - 窗口状态侦听器 b
从以下版本开始:
1.4

add

public static WindowFocusListener add(WindowFocusListener a,
                                      WindowFocusListener b)
添加窗口焦点侦听器 a 和窗口焦点侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 窗口焦点侦听器 a
b - 窗口焦点侦听器 b
从以下版本开始:
1.4

add

public static ActionListener add(ActionListener a,
                                 ActionListener b)
添加操作侦听器 a 和操作侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 操作侦听器 a
b - 操作侦听器 b

add

public static ItemListener add(ItemListener a,
                               ItemListener b)
添加项侦听器 a 和项侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 项侦听器 a
b - 项侦听器 b

add

public static AdjustmentListener add(AdjustmentListener a,
                                     AdjustmentListener b)
添加调整侦听器 a 和调整侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 调整侦听器 a
b - 调整侦听器 b

add

public static TextListener add(TextListener a,
                               TextListener b)

add

public static InputMethodListener add(InputMethodListener a,
                                      InputMethodListener b)
添加输入方法侦听器 a 和输入方法侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 输入方法侦听器 a
b - 输入方法侦听器 b

add

public static HierarchyListener add(HierarchyListener a,
                                    HierarchyListener b)
添加层次结构侦听器 a 和层次结构侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 层次结构侦听器 a
b - 层次结构侦听器 b
从以下版本开始:
1.3

add

public static HierarchyBoundsListener add(HierarchyBoundsListener a,
                                          HierarchyBoundsListener b)
添加层次结构边界侦听器 a 和层次结构边界侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 层次结构边界侦听器 a
b - 层次结构边界侦听器 b
从以下版本开始:
1.3

add

public static MouseWheelListener add(MouseWheelListener a,
                                     MouseWheelListener b)
添加鼠标滚轮侦听器 a 和鼠标滚轮侦听器 b,并返回得到的多路广播侦听器。

参数:
a - 鼠标滚轮侦听器 a
b - 鼠标滚轮侦听器 b

remove

public static ComponentListener remove(ComponentListener l,
                                       ComponentListener oldl)
从组件侦听器 l 中移除旧的组件侦听器,并返回得到的多路广播侦听器。

参数:
l - 组件侦听器 l
oldl - 正移除的组件侦听器

remove

public static ContainerListener remove(ContainerListener l,
                                       ContainerListener oldl)
从容器侦听器 l 中移除旧的容器侦听器,并返回得到的多路广播侦听器。

参数:
l - 容器侦听器 l
oldl - 正移除的容器侦听器

remove

public static FocusListener remove(FocusListener l,
                                   FocusListener oldl)
从焦点侦听器 l 中移除旧的焦点侦听器,并返回得到的多路广播侦听器。

参数:
l - 焦点侦听器 l
oldl - 正移除的焦点侦听器

remove

public static KeyListener remove(KeyListener l,
                                 KeyListener oldl)
从键侦听器 l 中移除旧的键侦听器,并返回得到的多路广播侦听器。

参数:
l - 键侦听器 l
oldl - 正移除的键侦听器

remove

public static MouseListener remove(MouseListener l,
                                   MouseListener oldl)
从鼠标侦听器 l 中移除旧的鼠标侦听器,并返回得到的多路广播侦听器。

参数:
l - 鼠标侦听器 l
oldl - 正移除的鼠标侦听器

remove

public static MouseMotionListener remove(MouseMotionListener l,
                                         MouseMotionListener oldl)
从鼠标移动侦听器 l 中移除旧的鼠标移动侦听器,并返回得到的多路广播侦听器。

参数:
l - 鼠标移动侦听器 l
oldl - 正移除的鼠标移动侦听器

remove

public static WindowListener remove(WindowListener l,
                                    WindowListener oldl)
从窗口侦听器 l 中移除旧的窗口侦听器,并返回得到的多路广播侦听器。

参数:
l - 窗口侦听器 l
oldl - 正移除的窗口侦听器

remove

public static WindowStateListener remove(WindowStateListener l,
                                         WindowStateListener oldl)
从窗口状态侦听器 l 中移除旧的窗口状态侦听器,并返回得到的多路广播侦听器。

参数:
l - 窗口状态侦听器 l
oldl - 正移除的窗口状态侦听器
从以下版本开始:
1.4

remove

public static WindowFocusListener remove(WindowFocusListener l,
                                         WindowFocusListener oldl)
从窗口焦点侦听器 l 中移除旧的窗口焦点侦听器,并返回得到的多路广播侦听器。

参数:
l - 窗口焦点侦听器 l
oldl - 正移除的窗口焦点侦听器
从以下版本开始:
1.4

remove

public static ActionListener remove(ActionListener l,
                                    ActionListener oldl)
从操作侦听器 l 中移除旧的操作侦听器,并返回得到的多路广播侦听器。

参数:
l - 操作侦听器 l
oldl - 正移除的操作侦听器

remove

public static ItemListener remove(ItemListener l,
                                  ItemListener oldl)
从项侦听器 l 中移除旧的项侦听器,并返回得到的多路广播侦听器。

参数:
l - 项侦听器 l
oldl - 正移除的项侦听器

remove

public static AdjustmentListener remove(AdjustmentListener l,
                                        AdjustmentListener oldl)
从调整侦听器 l 中移除旧的调整侦听器,并返回得到的多路广播侦听器。

参数:
l - 调整侦听器 l
oldl - 正移除的调整侦听器

remove

public static TextListener remove(TextListener l,
                                  TextListener oldl)

remove

public static InputMethodListener remove(InputMethodListener l,
                                         InputMethodListener oldl)
从输入方法侦听器 l 中移除旧的输入方法侦听器,并返回得到的多路广播侦听器。

参数:
l - 输入方法侦听器 l
oldl - 正移除的输入方法侦听器

remove

public static HierarchyListener remove(HierarchyListener l,
                                       HierarchyListener oldl)
从层次结构侦听器 l 中移除旧的层次结构侦听器,并返回得到的多路广播侦听器。

参数:
l - 层次结构侦听器 l
oldl - 正移除的层次结构侦听器
从以下版本开始:
1.3

remove

public static HierarchyBoundsListener remove(HierarchyBoundsListener l,
                                             HierarchyBoundsListener oldl)
从层次结构边界侦听器 l 中移除旧的层次结构边界侦听器,并返回得到的多路广播侦听器。

参数:
l - 层次结构边界侦听器 l
oldl - 正移除的层次结构边界侦听器
从以下版本开始:
1.3

remove

public static MouseWheelListener remove(MouseWheelListener l,
                                        MouseWheelListener oldl)
从鼠标滚轮侦听器 l 中移除旧的鼠标滚轮侦听器,并返回得到的多路广播侦听器。

参数:
l - 鼠标滚轮侦听器 l
oldl - 正移除的鼠标滚轮侦听器

addInternal

protected static EventListener addInternal(EventListener a,
                                           EventListener b)
从正添加的侦听器 a 和侦听器 b 中一起返回得到的多路广播侦听器。如果侦听器 a 为 null,则此方法将返回侦听器 b;如果侦听器 b 为 null,则此方法将返回侦听器 a;如果侦听器 a 和侦听器 b 都不为 null,则返回一个将 a 和 b 链接的新 AWTEventMulticaster 实例。

参数:
a - 事件侦听器 a
b - 事件侦听器 b

removeInternal

protected static EventListener removeInternal(EventListener l,
                                              EventListener oldl)
在从侦听器 l 中移除旧的侦听器之后,返回得到的多路广播侦听器。如果侦听器 l 与旧的侦听器相同,或者侦听器 l 为 null,则返回 null。否则,如果侦听器 l 是 AWTEventMulticaster 的一个实例,则从中移除旧的侦听器。其他情况则返回侦听器 l。

参数:
l - 正在其中执行移除操作的侦听器
oldl - 正移除的侦听器

saveInternal

protected void saveInternal(ObjectOutputStream s,
                            String k)
                     throws IOException
抛出:
IOException

save

protected static void save(ObjectOutputStream s,
                           String k,
                           EventListener l)
                    throws IOException
抛出:
IOException

getListeners

public static <T extends EventListener> T[] getListeners(EventListener l,
                                                         Class<T> listenerType)
返回通过指定的 java.util.EventListener 链接为 FooListener 的所有对象的数组。FooListener 是使用 addFooListener 方法、通过 AWTEventMulticaster 链接的。如果已指定一个 null 侦听器,则此方法将返回一个空数组。如果指定的侦听器不是 AWTEventMulticaster 的一个实例,则此方法将返回一个只包含指定侦听器的数组。如果没有链接这样的侦听器,则此方法将返回一个空数组。

参数:
l - 指定的 java.util.EventListener
listenerType - 所需的侦听器类型;该参数应该指定一个从 java.util.EventListener 遗传下来的接口
返回:
通过指定的多路广播侦听器链接为 FooListener 的所有对象的数组,如果没有通过指定的多路广播侦听器链接这样的侦听器,则返回一个空数组
抛出:
NullPointerException - 如果指定的 listenertype 参数为 null
ClassCastException - 如果 listenerType 没有指定实现 java.util.EventListener 的类或接口
从以下版本开始:
1.4

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策