- 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()); } } }add和remove方法的第一个参数是维护侦听器的字段。 此外,您必须将add和remove方法的结果分配给维护侦听器的字段。AWTEventMulticaster实现为在构造时设置的一对EventListeners。AWTEventMulticaster是不可变的。add,add和remove方法都不会改变AWTEventMulticaster。 如有必要,将创建一个新的AWTEventMulticaster。 通过这种方式,在事件调度过程中添加和删除侦听器是安全的。 但是,在事件调度操作过程中添加的事件侦听器不会被通知当前正在调度的事件。所有
add方法都允许null参数。 如果第一个参数是null,则返回第二个参数。 如果第一个参数不是null且第二个参数是null,则返回第一个参数。 如果两个参数都是non-null,则使用这两个参数创建一个新的AWTEventMulticaster并返回。对于
remove两个参数的remove方法,将返回以下内容:-
null,如果第一个参数是null,或者参数相等,则通过==。 - 第一个参数,如果第一个参数不是
AWTEventMulticaster的实例。 - 在第一个参数上调用
remove(EventListener)结果,为remove(EventListener)方法提供第二个参数。
Swing将
EventListenerList用于类似的逻辑。 有关详细信息,请参阅它。- 从以下版本开始:
- 1.1
- 另请参见:
-
EventListenerList
-
-
字段汇总
字段 变量和类型 字段 描述 protected EventListenera事件链中的变量(listener-a)protected EventListenerb事件链中的变量(侦听器-b)
-
构造方法摘要
构造方法 变量 构造器 描述 protectedAWTEventMulticaster(EventListener a, EventListener b)创建一个事件多播器实例,它将listener-a与listener-b链接起来。
-
方法摘要
所有方法 静态方法 实例方法 具体的方法 变量和类型 方法 描述 voidactionPerformed(ActionEvent e)通过在侦听器-a和侦听器-b上调用actionPerformed方法处理actionPerformed事件。static ActionListeneradd(ActionListener a, ActionListener b)使用action-listener-b添加action-listener-a并返回生成的多播侦听器。static AdjustmentListeneradd(AdjustmentListener a, AdjustmentListener b)使用adjust-listener-b添加adjust-listener-a并返回生成的多播侦听器。static ComponentListeneradd(ComponentListener a, ComponentListener b)使用component-listener-b添加component-listener-a并返回生成的多播侦听器。static ContainerListeneradd(ContainerListener a, ContainerListener b)使用container-listener-b添加container-listener-a并返回生成的多播侦听器。static FocusListeneradd(FocusListener a, FocusListener b)使用focus-listener-b添加focus-listener-a并返回生成的多播侦听器。static HierarchyBoundsListeneradd(HierarchyBoundsListener a, HierarchyBoundsListener b)使用hierarchy-bounds-listener-b添加hierarchy-bounds-listener-a并返回生成的多播侦听器。static HierarchyListeneradd(HierarchyListener a, HierarchyListener b)使用hierarchy-listener-b添加hierarchy-listener-a并返回生成的多播侦听器。static InputMethodListeneradd(InputMethodListener a, InputMethodListener b)使用input-method-listener-b添加input-method-listener-a并返回生成的多播侦听器。static ItemListeneradd(ItemListener a, ItemListener b)使用item-listener-b添加item-listener-a并返回生成的多播侦听器。static KeyListeneradd(KeyListener a, KeyListener b)使用key-listener-b添加key-listener-a并返回生成的多播侦听器。static MouseListeneradd(MouseListener a, MouseListener b)使用mouse-listener-b添加mouse-listener-a并返回生成的多播侦听器。static MouseMotionListeneradd(MouseMotionListener a, MouseMotionListener b)使用mouse-motion-listener-b添加mouse-motion-listener-a并返回生成的多播侦听器。static MouseWheelListeneradd(MouseWheelListener a, MouseWheelListener b)使用mouse-wheel-listener-b添加mouse-wheel-listener-a并返回生成的多播侦听器。static TextListeneradd(TextListener a, TextListener b)使用text-listener-b添加text-listener-a并返回生成的多播侦听器。static WindowFocusListeneradd(WindowFocusListener a, WindowFocusListener b)使用window-focus-listener-b添加window-focus-listener-a并返回生成的多播侦听器。static WindowListeneradd(WindowListener a, WindowListener b)使用window-listener-b添加window-listener-a并返回生成的多播侦听器。static WindowStateListeneradd(WindowStateListener a, WindowStateListener b)使用window-state-listener-b添加window-state-listener-a并返回生成的多播侦听器。protected static EventListeneraddInternal(EventListener a, EventListener b)通过将listener-a和listener-b一起添加,返回生成的多播侦听器。voidadjustmentValueChanged(AdjustmentEvent e)通过在侦听器-a和侦听器-b上调用adjustValueChanged方法处理adjustValueChanged事件。voidancestorMoved(HierarchyEvent e)通过在侦听器-a和侦听器-b上调用ancestorMoved方法来处理ancestorMoved事件。voidancestorResized(HierarchyEvent e)通过在侦听器-a和侦听器-b上调用ancestorResized方法处理ancestorResized事件。voidcaretPositionChanged(InputMethodEvent e)通过在listener-a和listener-b上调用caretPositionChanged方法处理caretPositionChanged事件。voidcomponentAdded(ContainerEvent e)通过在listener-a和listener-b上调用componentAdded方法处理componentAdded容器事件。voidcomponentHidden(ComponentEvent e)通过在侦听器-a和侦听器-b上调用componentHidden方法处理componentHidden事件。voidcomponentMoved(ComponentEvent e)通过在侦听器-a和侦听器-b上调用componentMoved方法处理componentMoved事件。voidcomponentRemoved(ContainerEvent e)通过在侦听器-a和侦听器-b上调用componentRemoved方法处理componentRemoved容器事件。voidcomponentResized(ComponentEvent e)通过在侦听器-a和侦听器-b上调用componentResized方法处理componentResized事件。voidcomponentShown(ComponentEvent e)通过在侦听器-a和侦听器-b上调用componentShown方法处理componentShown事件。voidfocusGained(FocusEvent e)通过在侦听器-a和侦听器-b上调用focusGained方法处理focusGained事件。voidfocusLost(FocusEvent e)通过在listener-a和listener-b上调用focusLost方法处理focusLost事件。static <T extends EventListener>
T[]getListeners(EventListener l, 类<T> listenerType)返回由指定的java.util.EventListener链接为FooListener的所有对象的数组。voidhierarchyChanged(HierarchyEvent e)通过在侦听器-a和侦听器-b上调用hierarchyChanged方法处理hierarchyChanged事件。voidinputMethodTextChanged(InputMethodEvent e)通过在侦听器-a和侦听器-b上调用inputMethodTextChanged方法处理inputMethodTextChanged事件。voiditemStateChanged(ItemEvent e)通过在侦听器-a和侦听器-b上调用itemStateChanged方法处理itemStateChanged事件。voidkeyPressed(KeyEvent e)通过在侦听器-a和侦听器-b上调用keyPressed方法处理keyPressed事件。voidkeyReleased(KeyEvent e)通过在侦听器-a和侦听器-b上调用keyReleased方法处理keyReleased事件。voidkeyTyped(KeyEvent e)通过在侦听器-a和侦听器-b上调用keyTyped方法来处理keyTyped事件。voidmouseClicked(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseClicked方法处理mouseClicked事件。voidmouseDragged(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseDragged方法处理mouseDragged事件。voidmouseEntered(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseEntered方法处理mouseEntered事件。voidmouseExited(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseExited方法处理mouseExited事件。voidmouseMoved(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseMoved方法处理mouseMoved事件。voidmousePressed(MouseEvent e)通过在侦听器-a和侦听器-b上调用mousePressed方法处理mousePressed事件。voidmouseReleased(MouseEvent e)通过在侦听器-a和侦听器-b上调用mouseReleased方法处理mouseReleased事件。voidmouseWheelMoved(MouseWheelEvent e)通过在侦听器-a和侦听器-b上调用mouseWheelMoved方法处理mouseWheelMoved事件。static ActionListenerremove(ActionListener l, ActionListener oldl)从action-listener-l中删除旧的操作侦听器,并返回生成的多播侦听器。static AdjustmentListenerremove(AdjustmentListener l, AdjustmentListener oldl)从adjust-listener-l中删除旧的adjust-listener,并返回生成的多播侦听器。static ComponentListenerremove(ComponentListener l, ComponentListener oldl)从component-listener-l中删除旧的组件侦听器,并返回生成的多播侦听器。static ContainerListenerremove(ContainerListener l, ContainerListener oldl)从container-listener-l中删除旧的容器侦听器,并返回生成的多播侦听器。static FocusListenerremove(FocusListener l, FocusListener oldl)从focus-listener-l中删除旧的focus-listener并返回生成的多播侦听器。static HierarchyBoundsListenerremove(HierarchyBoundsListener l, HierarchyBoundsListener oldl)从hierarchy-bounds-listener-l中删除旧的层次结构边界侦听器,并返回生成的多播侦听器。static HierarchyListenerremove(HierarchyListener l, HierarchyListener oldl)从hierarchy-listener-l中删除旧的层次结构侦听器,并返回生成的多播侦听器。static InputMethodListenerremove(InputMethodListener l, InputMethodListener oldl)从input-method-listener-l中删除旧的input-method-listener,并返回生成的多播侦听器。static ItemListenerremove(ItemListener l, ItemListener oldl)从item-listener-l中删除旧的item-listener并返回生成的多播侦听器。static KeyListenerremove(KeyListener l, KeyListener oldl)从key-listener-l中删除旧的key-listener并返回生成的多播侦听器。static MouseListenerremove(MouseListener l, MouseListener oldl)从mouse-listener-l中删除旧的鼠标侦听器,并返回生成的多播侦听器。static MouseMotionListenerremove(MouseMotionListener l, MouseMotionListener oldl)从mouse-motion-listener-l中删除旧的鼠标移动侦听器,并返回生成的多播侦听器。static MouseWheelListenerremove(MouseWheelListener l, MouseWheelListener oldl)从mouse-wheel-listener-l中删除旧的鼠标滚轮侦听器,并返回生成的多播侦听器。static TextListenerremove(TextListener l, TextListener oldl)从text-listener-l中删除旧的文本侦听器,并返回生成的多播侦听器。static WindowFocusListenerremove(WindowFocusListener l, WindowFocusListener oldl)从window-focus-listener-l中删除旧的window-focus-listener并返回生成的多播侦听器。static WindowListenerremove(WindowListener l, WindowListener oldl)从window-listener-l中删除旧的window-listener并返回生成的多播侦听器。static WindowStateListenerremove(WindowStateListener l, WindowStateListener oldl)从window-state-listener-l中删除旧的window-state-listener,并返回生成的多播侦听器。protected EventListenerremove(EventListener oldl)从此多播器中删除侦听器。protected static EventListenerremoveInternal(EventListener l, EventListener oldl)从侦听器l中删除旧侦听器后,返回生成的多播侦听器。protected static voidsave(ObjectOutputStream s, String k, EventListener l)将Serializable侦听器链保存到序列化流。protected voidsaveInternal(ObjectOutputStream s, String k)序列化支持。voidwindowActivated(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowActivated方法处理windowActivated事件。voidwindowClosed(WindowEvent e)通过在listener-a和listener-b上调用windowClosed方法处理windowClosed事件。voidwindowClosing(WindowEvent e)通过在listener-a和listener-b上调用windowClosing方法处理windowClosing事件。voidwindowDeactivated(WindowEvent e)通过在listener-a和listener-b上调用windowDeactivated方法处理windowDeactivated事件。voidwindowDeiconified(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowDeiconified方法处理windowDeiconified事件。voidwindowGainedFocus(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowGainedFocus方法来处理windowGainedFocus事件。voidwindowIconified(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowIconified方法处理windowIconified事件。voidwindowLostFocus(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowLostFocus方法处理windowLostFocus事件。voidwindowOpened(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowOpened方法处理windowOpened事件。voidwindowStateChanged(WindowEvent e)通过在侦听器-a和侦听器-b上调用windowStateChanged方法处理windowStateChanged事件。-
声明方法的类 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
声明方法的接口 java.awt.event.TextListener
textValueChanged
-
-
-
-
字段详细信息
-
a
protected final EventListener a
事件链中的变量(listener-a)
-
b
protected final EventListener b
事件链中的变量(侦听器-b)
-
-
构造方法详细信息
-
AWTEventMulticaster
protected AWTEventMulticaster(EventListener a, EventListener b)
创建一个事件多播器实例,它将listener-a与listener-b链接起来。 输入参数a和b不应该是null,但在选择是否在这种情况下抛出NullPointerException时,实现可能会有所不同。- 参数
-
a- 听众 - a -
b- 听众-b
-
-
方法详细信息
-
remove
protected EventListener remove(EventListener oldl)
从此多播器中删除侦听器。返回的多播器包含此多播器中的所有侦听器,但所有出现的
oldl。 如果生成的多播器只包含一个常规侦听器,则可能会返回常规侦听器。 如果生成的多播器为空,则可以返回null。如果
oldl是null则oldl引发异常。- 参数
-
oldl- 要删除的侦听器 - 结果
- 结果听众
-
componentResized
public void componentResized(ComponentEvent e)
通过在侦听器-a和侦听器-b上调用componentResized方法处理componentResized事件。- Specified by:
-
componentResized在界面ComponentListener - 参数
-
e- 组件事件
-
componentMoved
public void componentMoved(ComponentEvent e)
通过在侦听器-a和侦听器-b上调用componentMoved方法处理componentMoved事件。- Specified by:
-
componentMoved在界面ComponentListener - 参数
-
e- 组件事件
-
componentShown
public void componentShown(ComponentEvent e)
通过在侦听器-a和侦听器-b上调用componentShown方法处理componentShown事件。- Specified by:
-
componentShown在界面ComponentListener - 参数
-
e- 组件事件
-
componentHidden
public void componentHidden(ComponentEvent e)
通过在侦听器-a和侦听器-b上调用componentHidden方法处理componentHidden事件。- Specified by:
-
componentHidden在界面ComponentListener - 参数
-
e- 组件事件
-
componentAdded
public void componentAdded(ContainerEvent e)
通过在listener-a和listener-b上调用componentAdded方法处理componentAdded容器事件。- Specified by:
-
componentAdded在界面ContainerListener - 参数
-
e- 组件事件
-
componentRemoved
public void componentRemoved(ContainerEvent e)
通过在侦听器-a和侦听器-b上调用componentRemoved方法处理componentRemoved容器事件。- Specified by:
-
componentRemoved在界面ContainerListener - 参数
-
e- 组件事件
-
focusGained
public void focusGained(FocusEvent e)
通过在侦听器-a和侦听器-b上调用focusGained方法处理focusGained事件。- Specified by:
-
focusGainedin界面FocusListener - 参数
-
e- 焦点事件
-
focusLost
public void focusLost(FocusEvent e)
通过在listener-a和listener-b上调用focusLost方法处理focusLost事件。- Specified by:
-
focusLost,界面FocusListener - 参数
-
e- 焦点事件
-
keyTyped
public void keyTyped(KeyEvent e)
通过在侦听器-a和侦听器-b上调用keyTyped方法来处理keyTyped事件。- Specified by:
-
keyTyped在界面KeyListener - 参数
-
e- 关键事件
-
keyPressed
public void keyPressed(KeyEvent e)
通过在侦听器-a和侦听器-b上调用keyPressed方法处理keyPressed事件。- Specified by:
-
keyPressed接口KeyListener - 参数
-
e- 关键事件
-
keyReleased
public void keyReleased(KeyEvent e)
通过在侦听器-a和侦听器-b上调用keyReleased方法处理keyReleased事件。- Specified by:
-
keyReleased在界面KeyListener - 参数
-
e- 关键事件
-
mouseClicked
public void mouseClicked(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseClicked方法处理mouseClicked事件。- Specified by:
-
mouseClickedin interfaceMouseListener - 参数
-
e- 鼠标事件
-
mousePressed
public void mousePressed(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mousePressed方法处理mousePressed事件。- Specified by:
-
mousePressed在界面MouseListener - 参数
-
e- 鼠标事件
-
mouseReleased
public void mouseReleased(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseReleased方法处理mouseReleased事件。- Specified by:
-
mouseReleased在界面MouseListener - 参数
-
e- 鼠标事件
-
mouseEntered
public void mouseEntered(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseEntered方法处理mouseEntered事件。- Specified by:
-
mouseEntered在界面MouseListener - 参数
-
e- 鼠标事件
-
mouseExited
public void mouseExited(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseExited方法处理mouseExited事件。- Specified by:
-
mouseExited在界面MouseListener - 参数
-
e- 鼠标事件
-
mouseDragged
public void mouseDragged(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseDragged方法处理mouseDragged事件。- Specified by:
-
mouseDragged在界面MouseMotionListener - 参数
-
e- 鼠标事件
-
mouseMoved
public void mouseMoved(MouseEvent e)
通过在侦听器-a和侦听器-b上调用mouseMoved方法处理mouseMoved事件。- Specified by:
-
mouseMoved在界面MouseMotionListener - 参数
-
e- 鼠标事件
-
windowOpened
public void windowOpened(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowOpened方法处理windowOpened事件。- Specified by:
-
windowOpened在界面WindowListener - 参数
-
e- 窗口事件
-
windowClosing
public void windowClosing(WindowEvent e)
通过在listener-a和listener-b上调用windowClosing方法处理windowClosing事件。- Specified by:
-
windowClosing在界面WindowListener - 参数
-
e- 窗口事件
-
windowClosed
public void windowClosed(WindowEvent e)
通过在listener-a和listener-b上调用windowClosed方法处理windowClosed事件。- Specified by:
-
windowClosed在界面WindowListener - 参数
-
e- 窗口事件
-
windowIconified
public void windowIconified(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowIconified方法处理windowIconified事件。- Specified by:
-
windowIconified在界面WindowListener - 参数
-
e- 窗口事件 - 另请参见:
-
Window.setIconImage(java.awt.Image)
-
windowDeiconified
public void windowDeiconified(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowDeiconified方法处理windowDeiconified事件。- Specified by:
-
windowDeiconified在界面WindowListener - 参数
-
e- 窗口事件
-
windowActivated
public void windowActivated(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowActivated方法处理windowActivated事件。- Specified by:
-
windowActivated在界面WindowListener - 参数
-
e- 窗口事件
-
windowDeactivated
public void windowDeactivated(WindowEvent e)
通过在listener-a和listener-b上调用windowDeactivated方法处理windowDeactivated事件。- Specified by:
-
windowDeactivated在界面WindowListener - 参数
-
e- 窗口事件
-
windowStateChanged
public void windowStateChanged(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowStateChanged方法处理windowStateChanged事件。- Specified by:
-
windowStateChanged在界面WindowStateListener - 参数
-
e- 窗口事件 - 从以下版本开始:
- 1.4
-
windowGainedFocus
public void windowGainedFocus(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowGainedFocus方法来处理windowGainedFocus事件。- Specified by:
-
windowGainedFocus在界面WindowFocusListener - 参数
-
e- 窗口事件 - 从以下版本开始:
- 1.4
-
windowLostFocus
public void windowLostFocus(WindowEvent e)
通过在侦听器-a和侦听器-b上调用windowLostFocus方法处理windowLostFocus事件。- Specified by:
-
windowLostFocus在界面WindowFocusListener - 参数
-
e- 窗口事件 - 从以下版本开始:
- 1.4
-
actionPerformed
public void actionPerformed(ActionEvent e)
通过在侦听器-a和侦听器-b上调用actionPerformed方法处理actionPerformed事件。- Specified by:
-
actionPerformed在界面ActionListener - 参数
-
e- 动作事件
-
itemStateChanged
public void itemStateChanged(ItemEvent e)
通过在侦听器-a和侦听器-b上调用itemStateChanged方法处理itemStateChanged事件。- Specified by:
-
itemStateChanged在界面ItemListener - 参数
-
e- 项目事件
-
adjustmentValueChanged
public void adjustmentValueChanged(AdjustmentEvent e)
通过在侦听器-a和侦听器-b上调用adjustValueChanged方法处理adjustValueChanged事件。- Specified by:
-
adjustmentValueChanged在界面AdjustmentListener - 参数
-
e- 调整事件
-
inputMethodTextChanged
public void inputMethodTextChanged(InputMethodEvent e)
通过在侦听器-a和侦听器-b上调用inputMethodTextChanged方法处理inputMethodTextChanged事件。- Specified by:
-
inputMethodTextChanged在界面InputMethodListener - 参数
-
e- 项目事件
-
caretPositionChanged
public void caretPositionChanged(InputMethodEvent e)
通过在listener-a和listener-b上调用caretPositionChanged方法处理caretPositionChanged事件。- Specified by:
-
caretPositionChanged在界面InputMethodListener - 参数
-
e- 项目事件
-
hierarchyChanged
public void hierarchyChanged(HierarchyEvent e)
通过在侦听器-a和侦听器-b上调用hierarchyChanged方法处理hierarchyChanged事件。- Specified by:
-
hierarchyChanged在界面HierarchyListener - 参数
-
e- 项目事件 - 从以下版本开始:
- 1.3
- 另请参见:
-
HierarchyEvent.getChangeFlags()
-
ancestorMoved
public void ancestorMoved(HierarchyEvent e)
通过在侦听器-a和侦听器-b上调用ancestorMoved方法来处理ancestorMoved事件。- Specified by:
-
ancestorMoved在界面HierarchyBoundsListener - 参数
-
e- 项目事件 - 从以下版本开始:
- 1.3
-
ancestorResized
public void ancestorResized(HierarchyEvent e)
通过在侦听器-a和侦听器-b上调用ancestorResized方法处理ancestorResized事件。- Specified by:
-
ancestorResized在界面HierarchyBoundsListener - 参数
-
e- 项目事件 - 从以下版本开始:
- 1.3
-
mouseWheelMoved
public void mouseWheelMoved(MouseWheelEvent e)
通过在侦听器-a和侦听器-b上调用mouseWheelMoved方法处理mouseWheelMoved事件。- Specified by:
-
mouseWheelMoved在界面MouseWheelListener - 参数
-
e- 鼠标事件 - 从以下版本开始:
- 1.4
- 另请参见:
-
MouseWheelEvent
-
add
public static ComponentListener add(ComponentListener a, ComponentListener b)
使用component-listener-b添加component-listener-a并返回生成的多播侦听器。- 参数
-
a- component-listener-a -
b- component-listener-b - 结果
- 由此产生的倾听者
-
add
public static ContainerListener add(ContainerListener a, ContainerListener b)
使用container-listener-b添加container-listener-a并返回生成的多播侦听器。- 参数
-
a- container-listener-a -
b- container-listener-b - 结果
- 由此产生的倾听者
-
add
public static FocusListener add(FocusListener a, FocusListener b)
使用focus-listener-b添加focus-listener-a并返回生成的多播侦听器。- 参数
-
a- focus-listener-a -
b- focus-listener-b - 结果
- 由此产生的倾听者
-
add
public static KeyListener add(KeyListener a, KeyListener b)
使用key-listener-b添加key-listener-a并返回生成的多播侦听器。- 参数
-
a- key-listener-a -
b- key-listener-b - 结果
- 由此产生的倾听者
-
add
public static MouseListener add(MouseListener a, MouseListener b)
使用mouse-listener-b添加mouse-listener-a并返回生成的多播侦听器。- 参数
-
a- mouse-listener-a -
b- mouse-listener-b - 结果
- 由此产生的倾听者
-
add
public static MouseMotionListener add(MouseMotionListener a, MouseMotionListener b)
使用mouse-motion-listener-b添加mouse-motion-listener-a并返回生成的多播侦听器。- 参数
-
a- mouse-motion-listener-a -
b- mouse-motion-listener-b - 结果
- 由此产生的倾听者
-
add
public static WindowListener add(WindowListener a, WindowListener b)
使用window-listener-b添加window-listener-a并返回生成的多播侦听器。- 参数
-
a- window-listener-a -
b- window-listener-b - 结果
- 由此产生的倾听者
-
add
public static WindowStateListener add(WindowStateListener a, WindowStateListener b)
使用window-state-listener-b添加window-state-listener-a并返回生成的多播侦听器。- 参数
-
a- window-state-listener-a -
b- window-state-listener-b - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
add
public static WindowFocusListener add(WindowFocusListener a, WindowFocusListener b)
使用window-focus-listener-b添加window-focus-listener-a并返回生成的多播侦听器。- 参数
-
a- window-focus-listener-a -
b- window-focus-listener-b - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
add
public static ActionListener add(ActionListener a, ActionListener b)
使用action-listener-b添加action-listener-a并返回生成的多播侦听器。- 参数
-
a- 动作监听器 - a -
b- 动作监听器-b - 结果
- 由此产生的倾听者
-
add
public static ItemListener add(ItemListener a, ItemListener b)
使用item-listener-b添加item-listener-a并返回生成的多播侦听器。- 参数
-
a- item-listener-a -
b- item-listener-b - 结果
- 由此产生的倾听者
-
add
public static AdjustmentListener add(AdjustmentListener a, AdjustmentListener b)
使用adjust-listener-b添加adjust-listener-a并返回生成的多播侦听器。- 参数
-
a-a-listener-a -
b-b-listener-b - 结果
- 由此产生的倾听者
-
add
public static TextListener add(TextListener a, TextListener b)
使用text-listener-b添加text-listener-a并返回生成的多播侦听器。- 参数
-
a- text-listener-a -
b- text-listener-b - 结果
- 由此产生的倾听者
-
add
public static InputMethodListener add(InputMethodListener a, InputMethodListener b)
使用input-method-listener-b添加input-method-listener-a并返回生成的多播侦听器。- 参数
-
a- input-method-listener-a -
b- input-method-listener-b - 结果
- 由此产生的倾听者
-
add
public static HierarchyListener add(HierarchyListener a, HierarchyListener b)
使用hierarchy-listener-b添加hierarchy-listener-a并返回生成的多播侦听器。- 参数
-
a- hierarchy-listener-a -
b- hierarchy-listener-b - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.3
-
add
public static HierarchyBoundsListener add(HierarchyBoundsListener a, HierarchyBoundsListener b)
使用hierarchy-bounds-listener-b添加hierarchy-bounds-listener-a并返回生成的多播侦听器。- 参数
-
a- hierarchy-bounds-listener-a -
b- hierarchy-bounds-listener-b - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.3
-
add
public static MouseWheelListener add(MouseWheelListener a, MouseWheelListener b)
使用mouse-wheel-listener-b添加mouse-wheel-listener-a并返回生成的多播侦听器。- 参数
-
a- mouse-wheel-listener-a -
b- mouse-wheel-listener-b - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
remove
public static ComponentListener remove(ComponentListener l, ComponentListener oldl)
从component-listener-l中删除旧的组件侦听器,并返回生成的多播侦听器。- 参数
-
l- component-listener-l -
oldl- 要删除的组件侦听器 - 结果
- 由此产生的倾听者
-
remove
public static ContainerListener remove(ContainerListener l, ContainerListener oldl)
从container-listener-l中删除旧的容器侦听器,并返回生成的多播侦听器。- 参数
-
l- container-listener-l -
oldl- 正在删除容器侦听器 - 结果
- 由此产生的倾听者
-
remove
public static FocusListener remove(FocusListener l, FocusListener oldl)
从focus-listener-l中删除旧的focus-listener并返回生成的多播侦听器。- 参数
-
l- focus-listener-l -
oldl- 要删除的焦点侦听器 - 结果
- 由此产生的倾听者
-
remove
public static KeyListener remove(KeyListener l, KeyListener oldl)
从key-listener-l中删除旧的key-listener并返回生成的多播侦听器。- 参数
-
l- key-listener-l -
oldl- 要删除的键侦听器 - 结果
- 由此产生的倾听者
-
remove
public static MouseListener remove(MouseListener l, MouseListener oldl)
从mouse-listener-l中删除旧的鼠标侦听器,并返回生成的多播侦听器。- 参数
-
l- mouse-listener-l -
oldl- 正在删除鼠标侦听器 - 结果
- 由此产生的倾听者
-
remove
public static MouseMotionListener remove(MouseMotionListener l, MouseMotionListener oldl)
从mouse-motion-listener-l中删除旧的鼠标移动侦听器,并返回生成的多播侦听器。- 参数
-
l- mouse-motion-listener-l -
oldl- 正在删除鼠标移动侦听器 - 结果
- 由此产生的倾听者
-
remove
public static WindowListener remove(WindowListener l, WindowListener oldl)
从window-listener-l中删除旧的window-listener并返回生成的多播侦听器。- 参数
-
l- window-listener-l -
oldl- 正在删除窗口侦听器 - 结果
- 由此产生的倾听者
-
remove
public static WindowStateListener remove(WindowStateListener l, WindowStateListener oldl)
从window-state-listener-l中删除旧的window-state-listener,并返回生成的多播侦听器。- 参数
-
l- window-state-listener-l -
oldl- 正在删除窗口状态侦听器 - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
remove
public static WindowFocusListener remove(WindowFocusListener l, WindowFocusListener oldl)
从window-focus-listener-l中删除旧的window-focus-listener并返回生成的多播侦听器。- 参数
-
l- window-focus-listener-l -
oldl- 要删除的window-focus-listener - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
remove
public static ActionListener remove(ActionListener l, ActionListener oldl)
从action-listener-l中删除旧的操作侦听器,并返回生成的多播侦听器。- 参数
-
l- action-listener-l -
oldl- 正在删除动作侦听器 - 结果
- 由此产生的倾听者
-
remove
public static ItemListener remove(ItemListener l, ItemListener oldl)
从item-listener-l中删除旧的item-listener并返回生成的多播侦听器。- 参数
-
l- item-listener-l -
oldl- 要删除的项侦听器 - 结果
- 由此产生的倾听者
-
remove
public static AdjustmentListener remove(AdjustmentListener l, AdjustmentListener oldl)
从adjust-listener-l中删除旧的adjust-listener,并返回生成的多播侦听器。- 参数
-
l-l-listener-l -
oldl- 正在删除调整侦听器 - 结果
- 由此产生的倾听者
-
remove
public static TextListener remove(TextListener l, TextListener oldl)
从text-listener-l中删除旧的文本侦听器,并返回生成的多播侦听器。- 参数
-
l- text-listener-l -
oldl- 正在删除的文本侦听器 - 结果
- 由此产生的倾听者
-
remove
public static InputMethodListener remove(InputMethodListener l, InputMethodListener oldl)
从input-method-listener-l中删除旧的input-method-listener,并返回生成的多播侦听器。- 参数
-
l- input-method-listener-l -
oldl- 正在删除input-method-listener - 结果
- 由此产生的倾听者
-
remove
public static HierarchyListener remove(HierarchyListener l, HierarchyListener oldl)
从hierarchy-listener-l中删除旧的层次结构侦听器,并返回生成的多播侦听器。- 参数
-
l- hierarchy-listener-l -
oldl- 正在删除层次结构侦听器 - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.3
-
remove
public static HierarchyBoundsListener remove(HierarchyBoundsListener l, HierarchyBoundsListener oldl)
从hierarchy-bounds-listener-l中删除旧的层次结构边界侦听器,并返回生成的多播侦听器。- 参数
-
l- hierarchy-bounds-listener-l -
oldl- 要删除的层次结构边界侦听器 - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.3
-
remove
public static MouseWheelListener remove(MouseWheelListener l, MouseWheelListener oldl)
从mouse-wheel-listener-l中删除旧的鼠标滚轮侦听器,并返回生成的多播侦听器。- 参数
-
l- mouse-wheel-listener-l -
oldl- 正在删除鼠标滚轮侦听器 - 结果
- 由此产生的倾听者
- 从以下版本开始:
- 1.4
-
addInternal
protected static EventListener addInternal(EventListener a, EventListener b)
通过将listener-a和listener-b一起添加,返回生成的多播侦听器。 如果listener-a为null,则返回listener-b; 如果listener-b为null,则返回listener-a如果两者都不为null,则它创建并返回一个新的AWTEventMulticaster实例,该实例用b链接a。- 参数
-
a- 事件监听器a -
b- 事件侦听器-b - 结果
- 由此产生的倾听者
-
removeInternal
protected static EventListener removeInternal(EventListener l, EventListener oldl)
从侦听器l中删除旧侦听器后,返回生成的多播侦听器。 如果listener -l等于旧的侦听器或者listener-l为null,则返回null。 否则,如果listener-l是AWTEventMulticaster的一个实例,那么它将从中删除旧的侦听器。 否则,返回听众l。- 参数
-
l- 要从中删除的侦听器 -
oldl- 正在删除侦听器 - 结果
- 由此产生的倾听者
-
saveInternal
protected void saveInternal(ObjectOutputStream s, String k) throws IOException
序列化支持。 将所有Serializable侦听器保存到序列化流。- 参数
-
s- 要保存的流 -
k- 要在每个可序列化侦听器之前放置的前缀流 - 异常
-
IOException- 如果序列化失败
-
save
protected static void save(ObjectOutputStream s, String k, EventListener l) throws IOException
将Serializable侦听器链保存到序列化流。- 参数
-
s- 要保存的流 -
k- 要在每个可序列化侦听器之前放置的前缀流 -
l- 要保存的侦听器链 - 异常
-
IOException- 如果序列化失败
-
getListeners
public static <T extends EventListener> T[] getListeners(EventListener l, 类<T> listenerType)
返回由指定的java.util.EventListener链接为FooListener的所有对象的数组。FooListeners由AWTEventMulticaster使用addFooListener方法链接。 如果指定了null侦听器,则此方法返回一个空数组。 如果指定的侦听器不是AWTEventMulticaster的实例,则此方法返回仅包含指定侦听器的数组。 如果没有链接此类侦听器,则此方法返回一个空数组。- 参数类型
-
T- 侦听器类型 - 参数
-
l- 指定的java.util.EventListener -
listenerType- 请求的侦听器类型; 此参数应指定一个从java.util.EventListener下降的接口 - 结果
-
由指定的多播侦听器链接为
FooListener的所有对象的数组,如果指定的多播侦听器未链接此类侦听器,则为空数组 - 异常
-
NullPointerException- 如果指定的listenertype参数为null -
ClassCastException- 如果listenerType未指定实现java.util.EventListener的类或接口 - 从以下版本开始:
- 1.4
-
-